|
| 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: npm run full-sync 2>&1 | tee /tmp/dry-run.log |
| 47 | + working-directory: ${{ env.SAFE_SETTINGS_CODE_DIR }} |
| 48 | + env: |
| 49 | + GH_ORG: ${{ vars.SAFE_SETTINGS_GH_ORG }} |
| 50 | + APP_ID: ${{ vars.SAFE_SETTINGS_APP_ID }} |
| 51 | + PRIVATE_KEY: ${{ secrets.SAFE_SETTINGS_PRIVATE_KEY }} |
| 52 | + GITHUB_CLIENT_ID: ${{ vars.SAFE_SETTINGS_GITHUB_CLIENT_ID }} |
| 53 | + GITHUB_CLIENT_SECRET: ${{ secrets.SAFE_SETTINGS_GITHUB_CLIENT_SECRET }} |
| 54 | + WEBHOOK_SECRET: ${{ secrets.WEBHOOK_SECRET }} |
| 55 | + ADMIN_REPO: admin |
| 56 | + DEPLOYMENT_CONFIG_FILE: ${{ github.workspace }}/deployment-settings.yml |
| 57 | + FULL_SYNC_NOP: "true" |
| 58 | + LOG_LEVEL: debug |
| 59 | + |
| 60 | + # Runs even if the previous step crashed, so changes are always surfaced. |
| 61 | + # continue-on-error: finding diffs is informational, not a merge blocker — |
| 62 | + # a human must review but the PR is not blocked. |
| 63 | + - name: Report config changes |
| 64 | + if: always() |
| 65 | + continue-on-error: true |
| 66 | + run: | |
| 67 | + if grep -q "There are changes for branch" /tmp/dry-run.log; then |
| 68 | + echo "::warning::Config changes detected — human review required before merging" |
| 69 | + grep -A 2 "There are changes for branch" /tmp/dry-run.log |
| 70 | + exit 1 |
| 71 | + fi |
0 commit comments