فینورا پرو - سامانه جامع حسابداری و صدور فاکتور

ci(a08): pin targeted harness to artifact source commit not dispatch head

Davood Mehraban committed Nov 23, 2026 at 19:52 UTC 4d48448fe749382606f8d0d94d46e6e50cc3ba59
1 file changed +12 -1
.github/workflows/a08-targeted-native-reuse.yml
+12 -1
@@ -6,6 +6,10 @@ on:
6 description: 'Native Windows workflow run holding candidate NSIS from this exact commit'
7 required: true
8 type: string
9 + source_sha:
10 + description: 'Exact 40-character commit SHA used to build the installer (not the workflow dispatch SHA)'
11 + required: true
12 + type: string
13 expected_version:
14 description: 'Candidate installer version from that run'
15 required: true
@@ -18,8 +22,11 @@ jobs:
22 runs-on: windows-latest
23 timeout-minutes: 35
24 steps:
25 + # Re-run the benchmark harness from the exact binary-producing commit.
26 + # The workflow_dispatch event itself may be at a newer commit.
27 - uses: actions/checkout@v4
28 with:
29 + ref: ${{ inputs.source_sha }}
30 persist-credentials: false
31 - uses: actions/setup-node@v4
32 with:
@@ -29,12 +36,16 @@ jobs:
36 env:
37 GH_TOKEN: ${{ github.token }}
38 SOURCE_RUN: ${{ inputs.artifact_run_id }}
39 + SOURCE_SHA: ${{ inputs.source_sha }}
40 EXPECTED_VERSION: ${{ inputs.expected_version }}
41 run: |
42 if ($env:SOURCE_RUN -notmatch '^[0-9]+$') { throw 'Invalid source run ID' }
43 + if ($env:SOURCE_SHA -notmatch '^[a-fA-F0-9]{40}$') { throw 'Invalid source commit SHA' }
44 + if ((git rev-parse HEAD).Trim() -ne $env:SOURCE_SHA) { throw 'Checked out source SHA mismatch' }
45 if ($env:EXPECTED_VERSION -notmatch '^\d+\.\d+\.\d+$') { throw 'Invalid candidate version' }
46 $run=gh api "repos/$env:GITHUB_REPOSITORY/actions/runs/$env:SOURCE_RUN" | ConvertFrom-Json
37 - if ($run.head_sha -ne $env:GITHUB_SHA -or $run.status -ne 'completed' -or
47 + if ($run.head_sha -ne $env:SOURCE_SHA -or $run.status -ne 'completed' -or
48 + $run.conclusion -ne 'success' -or $run.event -notin @('pull_request','push','workflow_dispatch') -or
49 $run.path -notmatch 'windows-vm-native-lab.yml') {
50 throw 'Source must be a completed native lab run on exactly this commit'
51 }