Skip to content

Commit 5e609d3

Browse files
Nicolas Brieusselclaude
authored andcommitted
refactor: simplify dry-run gate — fail on changes, no JS parsing
Remove 80 lines of embedded github-script JS: upsert comment logic, known-bug detection, repo name extraction. Replace with two plain bash steps: run NOP with tee, grep for "There are changes for branch" and fail if found. Output is visible directly in Actions logs. Also drop pull-requests: write permission (no PR comment posted). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 93595c2 commit 5e609d3

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

.github/workflows/pr-dry-run.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Dry-run gate
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
dry-run:
12+
name: Safe-settings dry-run
13+
runs-on: ubuntu-24.04
14+
timeout-minutes: 30
15+
# Do not run on fork PRs — secrets are not available there
16+
if: github.event.pull_request.head.repo.full_name == github.repository
17+
env:
18+
SAFE_SETTINGS_VERSION: 2.1.17
19+
SAFE_SETTINGS_CODE_DIR: ${{ github.workspace }}/.safe-settings-code
20+
21+
steps:
22+
- name: Checkout PR branch
23+
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.event.pull_request.head.sha }}
26+
27+
- name: Checkout safe-settings app
28+
uses: actions/checkout@v4
29+
with:
30+
repository: github/safe-settings
31+
ref: ${{ env.SAFE_SETTINGS_VERSION }}
32+
path: ${{ env.SAFE_SETTINGS_CODE_DIR }}
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: "20"
38+
cache: npm
39+
cache-dependency-path: ${{ env.SAFE_SETTINGS_CODE_DIR }}/package-lock.json
40+
41+
- name: Install dependencies
42+
run: npm ci
43+
working-directory: ${{ env.SAFE_SETTINGS_CODE_DIR }}
44+
45+
- name: Run dry-run (NOP)
46+
run: |
47+
set -o pipefail
48+
npm run full-sync 2>&1 | tee /tmp/dry-run.log
49+
working-directory: ${{ env.SAFE_SETTINGS_CODE_DIR }}
50+
env:
51+
GH_ORG: ${{ vars.SAFE_SETTINGS_GH_ORG }}
52+
APP_ID: ${{ vars.SAFE_SETTINGS_APP_ID }}
53+
PRIVATE_KEY: ${{ secrets.SAFE_SETTINGS_PRIVATE_KEY }}
54+
GITHUB_CLIENT_ID: ${{ vars.SAFE_SETTINGS_GITHUB_CLIENT_ID }}
55+
GITHUB_CLIENT_SECRET: ${{ secrets.SAFE_SETTINGS_GITHUB_CLIENT_SECRET }}
56+
WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }}
57+
ADMIN_REPO: admin
58+
DEPLOYMENT_CONFIG_FILE: ${{ github.workspace }}/deployment-settings.yml
59+
FULL_SYNC_NOP: "true"
60+
LOG_LEVEL: debug
61+
62+
- name: Fail if config changes detected
63+
run: |
64+
if grep -q "There are changes for branch" /tmp/dry-run.log; then
65+
echo "Config changes detected — review the dry-run output above."
66+
grep "There are changes for branch" /tmp/dry-run.log
67+
exit 1
68+
fi

0 commit comments

Comments
 (0)