Refresh coupon merchant domains #1
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 coupon merchant domains | |
| on: | |
| schedule: | |
| - cron: '17 6 1 * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: coupon-domain-refresh | |
| cancel-in-progress: false | |
| jobs: | |
| refresh: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Refresh the reviewed snapshot | |
| run: npm run update:coupon-domains -- --as-of "$(date -u +%F)" | |
| - name: Verify generated data offline | |
| run: npm run update:coupon-domains -- --check | |
| - name: Run regression tests | |
| run: node test/run.js | |
| - name: Commit refresh | |
| id: commit | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add scripts/data/coupon-domains.provenance.json \ | |
| src/chrome/src/ui/coupon-domains.js \ | |
| src/firefox/src/ui/coupon-domains.js | |
| if git diff --cached --quiet; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| git commit -m "data: refresh coupon merchant domains" | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| - name: Push refresh branch | |
| if: steps.commit.outputs.changed == 'true' | |
| env: | |
| BRANCH: automation/coupon-domain-refresh | |
| run: | | |
| git fetch origin "$BRANCH:refs/remotes/origin/$BRANCH" || true | |
| git branch -f "$BRANCH" HEAD | |
| git push --force-with-lease origin "$BRANCH:$BRANCH" | |
| - name: Open draft pull request | |
| if: steps.commit.outputs.changed == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| BRANCH: automation/coupon-domain-refresh | |
| run: | | |
| existing=$(gh pr list --base main --head "$BRANCH" --state open --json url --jq '.[0].url') | |
| if [ -n "$existing" ]; then | |
| echo "Updated $existing" | |
| exit 0 | |
| fi | |
| gh pr create \ | |
| --base main \ | |
| --head "$BRANCH" \ | |
| --draft \ | |
| --title "data: refresh coupon merchant domains" \ | |
| --body "Refreshes the reviewed coupon-domain snapshot and provenance manifest from the bounded sources. The updater applied PSL validation and source/churn anomaly gates, then the workflow verified generated parity offline and ran the core regression suite." |