Autopost #1115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Autopost | |
on: | |
schedule: | |
- cron: "30 0 * * *" # every day at 7:30am GMT+7 | |
workflow_dispatch: # for manual trigger - testing | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Setup python | |
uses: actions/setup-python@v2 | |
- name: Install dependencies | |
run: | | |
cd scripts/autopost | |
pip install -r requirements.txt | |
- name: Autopost | |
run: | | |
cd scripts/autopost | |
python autopost.py | |
env: | |
FB_PAGE_ID: ${{ secrets.FB_PAGE_ID }} | |
FB_OAUTH_TOKEN: ${{ secrets.FB_OAUTH_TOKEN }} | |
TG_BOT_CHANNEL: ${{ secrets.TG_BOT_CHANNEL }} | |
TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} | |
TW_CONSUMER_KEY: ${{ secrets.TW_CONSUMER_KEY }} | |
TW_CONSUMER_SECRET: ${{ secrets.TW_CONSUMER_SECRET }} | |
TW_ACCESS_TOKEN: ${{ secrets.TW_ACCESS_TOKEN }} | |
TW_ACCESS_TOKEN_SECRET: ${{ secrets.TW_ACCESS_TOKEN_SECRET }} | |
IG_ACCOUNT_ID: ${{ secrets.IG_ACCOUNT_ID }} | |
IG_OAUTH_TOKEN: ${{ secrets.IG_OAUTH_TOKEN }} | |
- name: Commit changes | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git add -A | |
git commit -m "autopost" || true | |
git push --force origin HEAD:$GITHUB_REF || true |