Refresh Metagame Feeds #10
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: Refresh Metagame Feeds | |
| on: | |
| schedule: | |
| # Run daily at 06:00 UTC | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| refresh-feeds: | |
| name: Scrape & Commit Feeds | |
| # Forks inherit the schedule but not CI_PAT, so a fork run only fails and | |
| # spams the owner. Keep the daily scrape on the canonical repository. | |
| if: github.repository == 'phase-rs/phase' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache-shared-key: rust-feed-scraper | |
| - name: Build feed-scraper | |
| run: cargo build --release -p feed-scraper | |
| - name: Scrape metagame feeds | |
| run: | | |
| cargo run --release -p feed-scraper -- \ | |
| --format standard,modern,pioneer,commander \ | |
| --output-dir client/public/feeds/ \ | |
| --top 10 \ | |
| --delay 1500 | |
| - name: Check for changes | |
| id: diff | |
| run: | | |
| git diff --quiet client/public/feeds/mtggoldfish-*.json && echo "changed=false" >> "$GITHUB_OUTPUT" || echo "changed=true" >> "$GITHUB_OUTPUT" | |
| - name: Create or update feed refresh PR | |
| if: steps.diff.outputs.changed == 'true' | |
| uses: ./.github/actions/create-auto-merge-pr | |
| with: | |
| token: ${{ secrets.CI_PAT }} | |
| add-paths: client/public/feeds/mtggoldfish-*.json | |
| commit-message: "chore: refresh metagame feeds" | |
| branch: chore/refresh-metagame-feeds | |
| title: "chore: refresh metagame feeds" | |
| body: "Automated daily metagame feed refresh from MTGGoldfish." |