Repository navigation
[Factcheck] Remove the /factcheck blog from datacommons.org #661
Workflow file for this run
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
| # This workflow surfaces an annotation check in PR reviews when production feature flags are modified. | ||
|
Check warning on line 1 in .github/workflows/feature-flag-checks.yml
|
||
| name: Feature flag checks | ||
| on: | ||
| # zizmor: ignore[dangerous-triggers] - {Needed to post comments on PRs from forked repos; no PR code is checked out or executed.} | ||
| pull_request_target: | ||
| branches: ["master"] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| production_flag_change_warning: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Detect changes to prod feature flag files | ||
| uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | ||
| id: changes | ||
| with: | ||
| filters: | | ||
| prod_flags: | ||
| - 'server/config/feature_flag_configs/production.json' | ||
| - name: Comment production feature flag review checklist on PR | ||
| if: steps.changes.outputs.prod_flags == 'true' && github.event_name == 'pull_request_target' | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
| with: | ||
| script: | | ||
| const body = `⚠️ **PRODUCTION FEATURE FLAG CHANGE — REVIEW CHECKLIST** | ||
| Please conduct a careful review before merging this production change & coordinate with the oncaller. | ||
| Merging this PR will trigger a rolling restart of all Kubernetes pods in production. | ||
| ### Things to check before approving: | ||
| - [ ] **Staging Validated**: Have these exact flag changes been tested and verified in staging? | ||
| - [ ] **Cache Invalidation**: If API responses change, remember to clear the Redis cache after merging. | ||
| - [ ] **Time Window**: Ensure updates occur during global working hours; request lead approval for Friday–Sunday updates. | ||
| - [ ] **Oncall Communication**: Please additionally announce this update on the oncall thread. | ||
| - [ ] **Type Safety**: Verify that flag value types match what the server binary expects.`; | ||
| // Check if comment already exists from bot | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| }); | ||
| const existingComment = comments.find(c => c.user.type === 'Bot' && c.body.includes('PRODUCTION FEATURE FLAG CHANGE — REVIEW CHECKLIST')); | ||
| if (existingComment) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: existingComment.id, | ||
| body: body | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: body | ||
| }); | ||
| } | ||