Update Discourse data #23
This file contains hidden or 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: Update Discourse data | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 6 * * *" | |
| jobs: | |
| update-discourse-data: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/create-github-app-token@v1 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.WEBSITE_UPDATER_APPID }} | |
| private-key: ${{ secrets.WEBSITE_UPDATER_KEY }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Fetch latest data from Discourse | |
| run: | | |
| python tools/fetch-news.py | |
| python tools/fetch-faq.py | |
| - name: Configure Git author | |
| run: | | |
| git config --local user.name "precice-bot" | |
| git config --local user.email "[email protected]" | |
| - name: Commit changes (if any) | |
| run: | | |
| git add assets/data/news.json | |
| git add assets/data/faq.json | |
| git commit -m "Update Discourse data data [skip ci]" || echo "No changes to commit" | |
| - name: Push commit | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ steps.app-token.outputs.token }} | |
| branch: ${{ github.ref }} |