Skip to content

Commit 3cbd34a

Browse files
Resolve shared workflow repo/sha before checkout
Add a step that extracts workflow_repository and workflow_sha from the job context (using jq on toJSON(job)), validates them, and exposes them as step outputs via GITHUB_OUTPUT. Update the subsequent actions/checkout for .lizardbyte-common to use those outputs (steps.shared-workflow.outputs.repository and .sha) instead of job.workflow_repository/job.workflow_sha. This ensures the reusable/shared workflow repository and commit are resolved reliably before performing the checkout.
1 parent 1a58b3b commit 3cbd34a

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/localize.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,27 @@ jobs:
2121
- name: Checkout
2222
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
2323

24+
- name: Resolve shared workflow checkout
25+
id: shared-workflow
26+
env:
27+
JOB_CONTEXT: ${{ toJSON(job) }}
28+
run: |
29+
repository="$(jq -r '.workflow_repository // empty' <<< "${JOB_CONTEXT}")"
30+
sha="$(jq -r '.workflow_sha // empty' <<< "${JOB_CONTEXT}")"
31+
32+
if [ -z "${repository}" ] || [ -z "${sha}" ]; then
33+
echo "Unable to resolve shared workflow repository and sha from job context." >&2
34+
exit 1
35+
fi
36+
37+
echo "repository=${repository}" >> "${GITHUB_OUTPUT}"
38+
echo "sha=${sha}" >> "${GITHUB_OUTPUT}"
39+
2440
- name: Checkout lizardbyte-common
2541
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
2642
with:
27-
repository: ${{ job.workflow_repository }}
28-
ref: ${{ job.workflow_sha }}
43+
repository: ${{ steps.shared-workflow.outputs.repository }}
44+
ref: ${{ steps.shared-workflow.outputs.sha }}
2945
path: .lizardbyte-common
3046

3147
- name: Install Python

0 commit comments

Comments
 (0)