Skip to content

Commit 4f2cceb

Browse files
committed
Fix skip-ci check (another attempt)
1 parent 83c7562 commit 4f2cceb

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ concurrency:
1313
jobs:
1414
tests:
1515
uses: ./.github/workflows/tests.yml
16+
with:
17+
target_sha: ${{ github.event.pull_request.head.sha }}

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030

3131
tests:
3232
uses: ./.github/workflows/tests.yml
33+
with:
34+
target_sha: ${{ github.sha }}
3335

3436
release:
3537
name: Release

.github/workflows/tests.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: Tests
22

33
on:
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

611
permissions:
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;

0 commit comments

Comments
 (0)