Refresh #456
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: Refresh | |
on: | |
schedule: | |
- cron: '0 12 * * *' # Runs every day at 12 AM | |
push: | |
branches: | |
- main | |
jobs: | |
refresh: | |
runs-on: ubuntu-latest | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the | |
# added or changed files to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
# Update faq.md file in the repository | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: "3.10" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r tools/requirements.txt | |
- name: Update contributors.ms | |
run: | | |
python tools/update_contributors.py | |
- name: Update faq.md | |
# Run the script to update the faq.md file. An '=' sign is added in the command line arguments | |
# to allow the script to parse the arguments correctly. | |
run: | | |
python tools/update_faq_markdown.py \ | |
--client-id="${{ secrets.REDDIT_CLIENT_ID }}" \ | |
--client-secret="${{ secrets.REDDIT_CLIENT_SECRET }}" \ | |
--user-agent="${{ secrets.REDDIT_USER_AGENT }}" \ | |
# Commit all changed files back to the repository | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update FAQs from Reddit | |
commit_options: '--no-verify --signoff' | |
- name: Trigger GitHub pages rebuild | |
run: | | |
curl --fail --request POST \ | |
--url https://api.github.com/repos/${{ github.repository }}/pages/builds \ | |
--header "Authorization: Bearer $USER_TOKEN" | |
env: | |
USER_TOKEN: ${{ secrets.USER_TOKEN }} |