|
15 | 15 |
|
16 | 16 | jobs: |
17 | 17 | # ───────────────────────────────────────────────────────────────────────────── |
18 | | - # JOB 0 — changes |
19 | | - # Detects whether any non-docs files changed. When only .md files (or |
20 | | - # LICENSE / ISSUE_TEMPLATE) are modified, expensive jobs are skipped and |
21 | | - # report "skipped" (green) so required branch-protection checks are satisfied. |
22 | | - # ───────────────────────────────────────────────────────────────────────────── |
23 | | - changes: |
24 | | - runs-on: ubuntu-latest |
25 | | - outputs: |
26 | | - code: ${{ steps.filter.outputs.code }} |
27 | | - steps: |
28 | | - - name: Harden the runner (Audit all outbound calls) |
29 | | - uses: step-security/harden-runner@a90bcbc6539c36a85cdfeb73f7e2f433735f215b # v2.15.0 |
30 | | - with: |
31 | | - egress-policy: audit |
32 | | - |
33 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
34 | | - with: |
35 | | - fetch-depth: 0 |
36 | | - |
37 | | - - name: Check for non-docs changes |
38 | | - id: filter |
39 | | - run: | |
40 | | - if [ "${{ github.event_name }}" = "pull_request" ]; then |
41 | | - BASE="${{ github.event.pull_request.base.sha }}" |
42 | | - HEAD="${{ github.event.pull_request.head.sha }}" |
43 | | - else |
44 | | - BASE="${{ github.event.before }}" |
45 | | - HEAD="${{ github.sha }}" |
46 | | - fi |
47 | | - # No base SHA (force push / first push / workflow_dispatch) → always run |
48 | | - if [ -z "${BASE}" ] || [ "${BASE}" = "0000000000000000000000000000000000000000" ]; then |
49 | | - echo "code=true" >> "$GITHUB_OUTPUT" |
50 | | - echo "No base SHA — treating as code change" |
51 | | - exit 0 |
52 | | - fi |
53 | | - COUNT=$(git diff --name-only "${BASE}" "${HEAD}" \ |
54 | | - | grep -cvE '^(.*\.md|LICENSE(\.md)?|\.github/ISSUE_TEMPLATE/.*)$' || echo 0) |
55 | | - echo "code=$([ "${COUNT}" -gt 0 ] && echo 'true' || echo 'false')" >> "$GITHUB_OUTPUT" |
56 | | - echo "Non-docs changed files: ${COUNT}" |
57 | | -
|
58 | | - # ───────────────────────────────────────────────────────────────────────────── |
59 | | - # JOB 1 — check-version (post-merge only) |
| 18 | + # JOB 0 — check-version (post-merge only) |
60 | 19 | # Checks whether this push introduces a new version that needs releasing. |
61 | 20 | # All post-merge release jobs (build push, verify, scan, merge, cleanup) are |
62 | 21 | # gated on this output so that pipeline-only merges (no version bump) complete |
@@ -100,10 +59,9 @@ jobs: |
100 | 59 | # ───────────────────────────────────────────────────────────────────────────── |
101 | 60 | build-and-push: |
102 | 61 | runs-on: ubuntu-latest |
103 | | - needs: [check-version, changes] |
| 62 | + needs: check-version |
104 | 63 | if: | |
105 | 64 | always() && |
106 | | - needs.changes.outputs.code == 'true' && |
107 | 65 | (github.event_name == 'pull_request' || needs.check-version.outputs.is-new-version == 'true') |
108 | 66 | strategy: |
109 | 67 | fail-fast: true |
@@ -592,9 +550,8 @@ jobs: |
592 | 550 | # ───────────────────────────────────────────────────────────────────────────── |
593 | 551 | pre-merge-cd-check: |
594 | 552 | runs-on: ubuntu-latest |
595 | | - needs: [build-and-push, changes] |
| 553 | + needs: build-and-push |
596 | 554 | if: | |
597 | | - needs.changes.outputs.code == 'true' && |
598 | 555 | github.event_name == 'pull_request' && |
599 | 556 | github.event.pull_request.head.repo.full_name == github.repository |
600 | 557 | permissions: |
|
0 commit comments