Skip to content

Commit c630a01

Browse files
author
Bryan Howard
committed
Fix artifact search to use tag commit SHA instead of workflow commit
The create-release workflow was searching for builds using context.sha (the commit where the workflow file was updated) instead of the actual tag's commit SHA. This caused it to not find successful builds for tags. Solution: Look up the tag's commit SHA and search for workflow runs that built that specific commit. 🤖 Generated with [Claude Code](https://claude.ai/code)
1 parent be78bbe commit c630a01

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

.github/workflows/create-release.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,27 @@ jobs:
5555
script: |
5656
const artifactName = `PyFlowGraph-Windows-${{ inputs.tag_name }}`;
5757
58-
// Search for workflow runs that built this tag
58+
// Get the commit SHA for the tag
59+
const tagRef = await github.rest.git.getRef({
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
ref: 'tags/${{ inputs.tag_name }}'
63+
});
64+
const tagSha = tagRef.data.object.sha;
65+
console.log(`Tag ${{ inputs.tag_name }} points to commit: ${tagSha}`);
66+
67+
// Search for workflow runs that built this specific commit
5968
const workflowRuns = await github.rest.actions.listWorkflowRunsForRepo({
6069
owner: context.repo.owner,
6170
repo: context.repo.repo,
6271
workflow_id: 'windows-build.yml',
63-
head_sha: context.sha,
72+
head_sha: tagSha,
6473
status: 'completed',
6574
conclusion: 'success'
6675
});
6776
6877
if (workflowRuns.data.workflow_runs.length === 0) {
69-
throw new Error(`No successful build found for tag ${{ inputs.tag_name }}`);
78+
throw new Error(`No successful build found for tag ${{ inputs.tag_name }} (commit: ${tagSha})`);
7079
}
7180
7281
const runId = workflowRuns.data.workflow_runs[0].id;

0 commit comments

Comments
 (0)