




















@@ -2,6 +2,12 @@ name: CI
2233on:
44workflow_dispatch:
5+inputs:
6+target_ref:
7+description: Optional branch, tag, or full commit SHA to validate instead of the workflow ref
8+required: false
9+default: ""
10+type: string
511push:
612branches: [main]
713paths-ignore:
@@ -30,6 +36,7 @@ jobs:
3036runs-on: ubuntu-24.04
3137timeout-minutes: 20
3238outputs:
39+checkout_sha: ${{ steps.checkout_ref.outputs.sha }}
3340docs_only: ${{ steps.manifest.outputs.docs_only }}
3441docs_changed: ${{ steps.manifest.outputs.docs_changed }}
3542run_node: ${{ steps.manifest.outputs.run_node }}
@@ -66,11 +73,16 @@ jobs:
6673 - name: Checkout
6774uses: actions/checkout@v6
6875with:
76+ref: ${{ inputs.target_ref || github.sha }}
6977fetch-depth: 1
7078fetch-tags: false
7179persist-credentials: false
7280submodules: false
738182+ - name: Resolve checkout SHA
83+id: checkout_ref
84+run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
85+7486 - name: Ensure preflight base commit
7587if: github.event_name != 'workflow_dispatch'
7688uses: ./.github/actions/ensure-base-commit
@@ -302,12 +314,14 @@ jobs:
302314 - name: Checkout
303315uses: actions/checkout@v6
304316with:
317+ref: ${{ inputs.target_ref || github.sha }}
305318fetch-depth: 1
306319fetch-tags: false
307320persist-credentials: false
308321submodules: false
309322310323 - name: Ensure security base commit
324+if: github.event_name != 'workflow_dispatch'
311325uses: ./.github/actions/ensure-base-commit
312326with:
313327base-sha: ${{ github.event_name == 'push' && github.event.before || github.event.pull_request.base.sha }}
@@ -391,6 +405,7 @@ jobs:
391405 - name: Checkout
392406uses: actions/checkout@v6
393407with:
408+ref: ${{ inputs.target_ref || github.sha }}
394409fetch-depth: 1
395410fetch-tags: false
396411persist-credentials: false
@@ -453,7 +468,7 @@ jobs:
453468shell: bash
454469env:
455470CHECKOUT_REPO: ${{ github.repository }}
456-CHECKOUT_SHA: ${{ github.sha }}
471+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
457472CHECKOUT_TOKEN: ${{ github.token }}
458473run: |
459474 set -euo pipefail
@@ -525,7 +540,7 @@ jobs:
525540path: |
526541 dist/
527542 dist-runtime/
528- key: ${{ runner.os }}-dist-build-${{ github.sha }}
543+ key: ${{ runner.os }}-dist-build-${{ needs.preflight.outputs.checkout_sha }}
529544530545 - name: Pack built runtime artifacts
531546run: tar --posix -cf dist-runtime-build.tar.zst --use-compress-program zstdmt dist dist-runtime
@@ -654,7 +669,7 @@ jobs:
654669shell: bash
655670env:
656671CHECKOUT_REPO: ${{ github.repository }}
657-CHECKOUT_SHA: ${{ github.sha }}
672+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
658673CHECKOUT_TOKEN: ${{ github.token }}
659674run: |
660675 set -euo pipefail
@@ -749,7 +764,7 @@ jobs:
749764shell: bash
750765env:
751766CHECKOUT_REPO: ${{ github.repository }}
752-CHECKOUT_SHA: ${{ github.sha }}
767+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
753768CHECKOUT_TOKEN: ${{ github.token }}
754769run: |
755770 set -euo pipefail
@@ -852,7 +867,7 @@ jobs:
852867shell: bash
853868env:
854869CHECKOUT_REPO: ${{ github.repository }}
855-CHECKOUT_SHA: ${{ github.sha }}
870+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
856871CHECKOUT_TOKEN: ${{ github.token }}
857872run: |
858873 set -euo pipefail
@@ -920,7 +935,7 @@ jobs:
920935shell: bash
921936env:
922937CHECKOUT_REPO: ${{ github.repository }}
923-CHECKOUT_SHA: ${{ github.sha }}
938+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
924939CHECKOUT_TOKEN: ${{ github.token }}
925940run: |
926941 set -euo pipefail
@@ -1040,7 +1055,7 @@ jobs:
10401055shell: bash
10411056env:
10421057CHECKOUT_REPO: ${{ github.repository }}
1043-CHECKOUT_SHA: ${{ github.sha }}
1058+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
10441059CHECKOUT_TOKEN: ${{ github.token }}
10451060run: |
10461061 set -euo pipefail
@@ -1120,7 +1135,7 @@ jobs:
11201135shell: bash
11211136env:
11221137CHECKOUT_REPO: ${{ github.repository }}
1123-CHECKOUT_SHA: ${{ github.sha }}
1138+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
11241139CHECKOUT_TOKEN: ${{ github.token }}
11251140run: |
11261141 set -euo pipefail
@@ -1307,7 +1322,7 @@ jobs:
13071322shell: bash
13081323env:
13091324CHECKOUT_REPO: ${{ github.repository }}
1310-CHECKOUT_SHA: ${{ github.sha }}
1325+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
13111326CHECKOUT_TOKEN: ${{ github.token }}
13121327run: |
13131328 set -euo pipefail
@@ -1439,7 +1454,7 @@ jobs:
14391454shell: bash
14401455env:
14411456CHECKOUT_REPO: ${{ github.repository }}
1442-CHECKOUT_SHA: ${{ github.sha }}
1457+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
14431458CHECKOUT_TOKEN: ${{ github.token }}
14441459run: |
14451460 set -euo pipefail
@@ -1637,7 +1652,7 @@ jobs:
16371652shell: bash
16381653env:
16391654CHECKOUT_REPO: ${{ github.repository }}
1640-CHECKOUT_SHA: ${{ github.sha }}
1655+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
16411656CHECKOUT_TOKEN: ${{ github.token }}
16421657run: |
16431658 set -euo pipefail
@@ -1700,6 +1715,7 @@ jobs:
17001715 - name: Checkout
17011716uses: actions/checkout@v6
17021717with:
1718+ref: ${{ needs.preflight.outputs.checkout_sha }}
17031719persist-credentials: false
17041720submodules: false
17051721@@ -1742,6 +1758,7 @@ jobs:
17421758 - name: Checkout
17431759uses: actions/checkout@v6
17441760with:
1761+ref: ${{ needs.preflight.outputs.checkout_sha }}
17451762persist-credentials: false
17461763submodules: false
17471764@@ -1846,6 +1863,7 @@ jobs:
18461863 - name: Checkout
18471864uses: actions/checkout@v6
18481865with:
1866+ref: ${{ needs.preflight.outputs.checkout_sha }}
18491867persist-credentials: false
18501868submodules: false
18511869@@ -1886,6 +1904,7 @@ jobs:
18861904 - name: Checkout
18871905uses: actions/checkout@v6
18881906with:
1907+ref: ${{ needs.preflight.outputs.checkout_sha }}
18891908persist-credentials: false
18901909submodules: false
18911910@@ -1986,7 +2005,7 @@ jobs:
19862005shell: bash
19872006env:
19882007CHECKOUT_REPO: ${{ github.repository }}
1989-CHECKOUT_SHA: ${{ github.sha }}
2008+CHECKOUT_SHA: ${{ needs.preflight.outputs.checkout_sha }}
19902009CHECKOUT_TOKEN: ${{ github.token }}
19912010run: |
19922011 set -euo pipefail
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。