Skip to content

Commit

Permalink
chore: general updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Dec 6, 2024
1 parent 3709b19 commit faf576c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 92 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,23 @@ on:
workflow_dispatch:

jobs:
facebook_group:
test_post:
runs-on: ubuntu-latest
strategy:
matrix:
target: [group, page]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: facebook-post-action
uses: ./
with:
page_id: ${{ secrets.FACEBOOK_GROUP_ID }}
page_id: ${{ matrix.target == 'group' && secrets.FACEBOOK_GROUP_ID || secrets.FACEBOOK_PAGE_ID }}
access_token: ${{ secrets.FACEBOOK_ACCESS_TOKEN }}
message: |
${{ github.event.repository.name }} - ${{ github.ref_name }}
Group test successful
url: https://github.com/ReenigneArcher/facebook-post-action
fail_on_error: false

facebook_page:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: facebook-post-action
uses: ./
with:
page_id: ${{ secrets.FACEBOOK_PAGE_ID }}
access_token: ${{ secrets.FACEBOOK_ACCESS_TOKEN }}
message: |
${{ github.event.repository.name }} - ${{ github.ref_name }}
Page test successful
${{ matrix.target == 'group' && 'Group' || 'Page' }} test successful
url: https://github.com/ReenigneArcher/facebook-post-action
fail_on_error: ${{ matrix.target == 'group' && 'false' || 'true' }}
5 changes: 0 additions & 5 deletions HISTORY.md

This file was deleted.

24 changes: 14 additions & 10 deletions facebook_post_action.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# standard imports
import os
import requests
import sys

# lib imports
from dotenv import load_dotenv
import requests

load_dotenv()

# inputs
Expand All @@ -15,15 +15,19 @@
URL = os.getenv('INPUT_URL', None)
FAIL_ON_ERROR = os.getenv('INPUT_FAIL_ON_ERROR', 'true')

FACEBOOK_API_END = 'https://graph.facebook.com/{0}/feed'.format(PAGE_ID)
FACEBOOK_API_END = f'https://graph.facebook.com/{PAGE_ID}/feed'

if URL:
FACEBOOK_API_DATA = {'message': MESSAGE,
'link': URL,
'access_token': ACCESS_TOKEN}
FACEBOOK_API_DATA = {
'message': MESSAGE,
'link': URL,
'access_token': ACCESS_TOKEN,
}
else:
FACEBOOK_API_DATA = {'message': MESSAGE,
'access_token': ACCESS_TOKEN}
FACEBOOK_API_DATA = {
'message': MESSAGE,
'access_token': ACCESS_TOKEN,
}

r = requests.post(url=FACEBOOK_API_END, json=FACEBOOK_API_DATA)

Expand Down
56 changes: 0 additions & 56 deletions utils.py

This file was deleted.

0 comments on commit faf576c

Please sign in to comment.