Upstream Watch #29
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: Upstream Watch | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "17 9 * * *" | |
| permissions: | |
| contents: write | |
| issues: write | |
| concurrency: | |
| group: upstream-watch | |
| cancel-in-progress: false | |
| env: | |
| UPSTREAM_WATCH_STATE_FILE: .cache/upstream-watch/upstream-watch-state.json | |
| jobs: | |
| watch: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Restore upstream watch state cache | |
| id: restore-upstream-watch-state | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: ${{ env.UPSTREAM_WATCH_STATE_FILE }} | |
| key: upstream-watch-state-${{ github.repository_id }}-${{ github.ref_name }}-${{ github.run_id }} | |
| restore-keys: | | |
| upstream-watch-state-${{ github.repository_id }}-${{ github.ref_name }}- | |
| - name: Seed upstream watch state | |
| run: | | |
| mkdir -p "$(dirname "${{ env.UPSTREAM_WATCH_STATE_FILE }}")" | |
| if [ ! -f "${{ env.UPSTREAM_WATCH_STATE_FILE }}" ]; then | |
| cp .github/upstream-watch-state.json "${{ env.UPSTREAM_WATCH_STATE_FILE }}" | |
| fi | |
| - name: Validate upstream watch config | |
| run: python3 scripts/upstream_watch.py --validate-config | |
| - name: Run upstream watch | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: python3 scripts/upstream_watch.py --state "${{ env.UPSTREAM_WATCH_STATE_FILE }}" | |
| - name: Save upstream watch state cache | |
| if: always() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: ${{ env.UPSTREAM_WATCH_STATE_FILE }} | |
| key: upstream-watch-state-${{ github.repository_id }}-${{ github.ref_name }}-${{ github.run_id }} |