Check content freshness #26
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: Check content freshness | |
| on: | |
| schedule: | |
| # Weekly - upstream adds new scenes on the order of months, not days, | |
| # so there's no value in checking more often than this. | |
| - cron: "0 6 * * 1" | |
| push: | |
| paths: | |
| - scripts/asciimation_sync.py | |
| - scripts/check_film_freshness.py | |
| - .github/workflows/content-freshness.yml | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| actions: write | |
| jobs: | |
| check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v7.0.1 | |
| - name: Check film data freshness | |
| id: freshness | |
| continue-on-error: true | |
| run: python3 scripts/check_film_freshness.py | |
| - name: Open tracking issue if stale | |
| if: steps.freshness.outcome == 'failure' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -eu | |
| existing=$(gh issue list --label content-freshness --state open --json number --jq 'length') | |
| if [ "$existing" -gt 0 ]; then | |
| echo "An open content-freshness issue already exists, skipping." | |
| else | |
| gh issue create \ | |
| --title "Asciimation content is out of date" \ | |
| --label content-freshness \ | |
| --assignee modem7 \ | |
| --body "The scheduled content-freshness check found that \`src/index.html\`'s film data no longer matches upstream (https://www.asciimation.co.nz/Blinkenlights/). The \"Update film data\" workflow has been triggered automatically to open a PR with the refresh. This issue will need to be closed manually once that PR is merged - the check doesn't auto-close it, to avoid closing an issue someone is still actively working." | |
| fi | |
| - name: Trigger automated update PR | |
| if: steps.freshness.outcome == 'failure' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: gh workflow run update-film-data.yml --ref master | |
| - name: Fail the job if stale | |
| if: steps.freshness.outcome == 'failure' | |
| run: exit 1 |