Skip to content

Commit d33c285

Browse files
committed
fix(go-lint): use GITHUB_JOB_WORKFLOW_SHA not caller-scoped GITHUB_WORKFLOW_SHA for config pin (F1)
1 parent cd4a53a commit d33c285

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎.github/workflows/go-lint.yaml‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,16 @@ jobs:
6262
exit 0
6363
fi
6464
# Pin the shared default config to the exact commit of *this*
65-
# reusable workflow (GITHUB_WORKFLOW_SHA) rather than the mutable
66-
# `main` branch, so the lint config is immutable and matches the
67-
# SHA the consumer pinned its `uses:` to. Falls back to main only
65+
# reusable workflow rather than the mutable `main` branch, so the
66+
# lint config is immutable and matches the SHA the consumer pinned
67+
# its `uses:` to. GITHUB_JOB_WORKFLOW_SHA (github.job_workflow_sha)
68+
# is the commit SHA of the reusable workflow file that defines this
69+
# job; GITHUB_WORKFLOW_SHA must NOT be used here — in a reusable
70+
# workflow the github context is the *caller's*, so it holds the
71+
# consumer repo's commit, which does not exist under
72+
# kupecloud/github-workflows and would 404. Falls back to main only
6873
# if the variable is unset (e.g. older runner).
69-
CONFIG_REF="${GITHUB_WORKFLOW_SHA:-main}"
74+
CONFIG_REF="${GITHUB_JOB_WORKFLOW_SHA:-main}"
7075
CONFIG_URL="https://raw.githubusercontent.com/kupecloud/github-workflows/${CONFIG_REF}/golangci-default.yaml"
7176
echo "No local golangci config found — downloading shared default from ${CONFIG_REF}"
7277
curl -sSfL "$CONFIG_URL" -o .golangci.yaml

0 commit comments

Comments
 (0)