Update job listings #20
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 job listings | |
| on: | |
| schedule: | |
| # Daily, ~6:20am ET. Odd minute to avoid GitHub's on-the-hour cron congestion. | |
| - cron: "23 10 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| allow_snapshot_reset: | |
| description: Replace an incompatible prior snapshot after auditing the new output | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| issues: write | |
| concurrency: | |
| group: update-listings | |
| cancel-in-progress: true | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Regenerate listings | |
| run: node .github/scripts/update.mjs .github/scripts/config.json --out . | |
| env: | |
| DREAMWORK_JOB_LIST_ALLOW_SNAPSHOT_RESET: ${{ inputs.allow_snapshot_reset && '1' || '0' }} | |
| - name: Commit and push if changed | |
| run: | | |
| git config user.name "dreamwork-bot" | |
| git config user.email "bots@dreamworkhq.com" | |
| git add README.md data/listings.json | |
| if git diff --staged --quiet; then | |
| echo "No changes today." | |
| else | |
| git commit -m "chore: update listings ($(date -u +%Y-%m-%d))" | |
| git push | |
| fi | |
| - name: Open issue on failure | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const label = "update-failure"; | |
| const { data: open } = await github.rest.issues.listForRepo({ | |
| ...context.repo, state: "open", labels: label, | |
| }); | |
| const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | |
| if (open.length > 0) { | |
| await github.rest.issues.createComment({ | |
| ...context.repo, issue_number: open[0].number, | |
| body: `Daily update failed again: ${runUrl}`, | |
| }); | |
| } else { | |
| await github.rest.issues.create({ | |
| ...context.repo, | |
| title: `Daily listings update is failing (${new Date().toISOString().slice(0, 10)})`, | |
| body: `The scheduled update workflow failed. Latest run: ${runUrl}\n\ncc @benadamsky`, | |
| labels: [label], | |
| }); | |
| } |