File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,5 @@ concurrency:
1313jobs :
1414 tests :
1515 uses : ./.github/workflows/tests.yml
16+ with :
17+ target_sha : ${{ github.event.pull_request.head.sha }}
Original file line number Diff line number Diff line change 3030
3131 tests :
3232 uses : ./.github/workflows/tests.yml
33+ with :
34+ target_sha : ${{ github.sha }}
3335
3436 release :
3537 name : Release
Original file line number Diff line number Diff line change @@ -2,6 +2,11 @@ name: Tests
22
33on :
44 workflow_call :
5+ inputs :
6+ target_sha :
7+ description : Commit SHA to inspect for Codecov skip markers.
8+ required : false
9+ type : string
510
611permissions :
712 contents : read
@@ -82,11 +87,16 @@ jobs:
8287 - name : Determine skip-codecov
8388 uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
8489 id : skip-codecov
90+ env :
91+ TARGET_SHA : ${{ inputs.target_sha || github.sha }}
8592 with :
8693 script : |
87- // Sets `ref` to the SHA of the current pull request's head commit,
88- // or, if not present, to the SHA of the workflow run's commit.
89- const ref = context.payload?.pull_request?.head?.sha ?? context.sha;
94+ // Prefer caller-provided SHA (PR head), otherwise fall back to the
95+ // workflow run's commit SHA.
96+ const ref = process.env.TARGET_SHA || context.payload?.pull_request?.head?.sha || context.sha;
97+ if (!ref) {
98+ throw new Error("Unable to determine commit SHA for Codecov skip check.");
99+ }
90100 const { repo, owner } = context.repo;
91101 const { data: commit } = await github.rest.repos.getCommit({ owner, repo, ref });
92102 const commitMessage = commit.commit.message;
You can’t perform that action at this time.
0 commit comments