@@ -22,8 +22,8 @@ if [[ $# -lt 2 ]]; then
2222 exit 1
2323fi
2424
25- GIT_TAG=" $1 "
26- REPOSITORY=" $2 "
25+ GIT_TAG=" ${1} "
26+ REPOSITORY=" ${2} "
2727WORKFLOW_NAME=" ${3:- CI} "
2828
2929# Ensure we have required tools
@@ -42,58 +42,58 @@ if ! command -v gh >/dev/null 2>&1; then
4242 exit 1
4343fi
4444
45- echo " Looking up run ID for tag: $GIT_TAG in repository: $REPOSITORY " >&2
45+ echo " Looking up run ID for tag: ${ GIT_TAG} in repository: ${ REPOSITORY} " >&2
4646
4747# Resolve git tag to commit SHA
48- if ! COMMIT_SHA=$( git rev-parse " $GIT_TAG " 2> /dev/null ) ; then
49- echo " Error: Could not resolve git tag '$GIT_TAG ' to a commit SHA" >&2
48+ if ! COMMIT_SHA=$( git rev-parse " ${ GIT_TAG} " ) ; then
49+ echo " Error: Could not resolve git tag '${ GIT_TAG} ' to a commit SHA" >&2
5050 echo " Make sure the tag exists and you have fetched it" >&2
5151 exit 1
5252fi
5353
54- echo " Resolved tag '$GIT_TAG ' to commit: $COMMIT_SHA " >&2
54+ echo " Resolved tag '${ GIT_TAG} ' to commit: ${ COMMIT_SHA} " >&2
5555
5656# Find workflow runs for this commit
57- echo " Searching for '$WORKFLOW_NAME ' workflow runs for commit: $COMMIT_SHA " >&2
57+ echo " Searching for '${ WORKFLOW_NAME} ' workflow runs for commit: ${ COMMIT_SHA} " >&2
5858
5959# Get workflow runs for the commit, filter by workflow name and successful status
6060RUN_DATA=$( gh run list \
61- --repo " $REPOSITORY " \
62- --commit " $COMMIT_SHA " \
63- --workflow " $WORKFLOW_NAME " \
61+ --repo " ${ REPOSITORY} " \
62+ --commit " ${ COMMIT_SHA} " \
63+ --workflow " ${ WORKFLOW_NAME} " \
6464 --status completed \
6565 --json databaseId,workflowName,status,conclusion,headSha \
6666 --limit 10)
6767
68- if [[ -z " $RUN_DATA " || " $RUN_DATA " == " []" ]]; then
69- echo " Error: No completed '$WORKFLOW_NAME ' workflow runs found for commit $COMMIT_SHA " >&2
68+ if [[ -z " ${ RUN_DATA} " || " ${ RUN_DATA} " == " []" ]]; then
69+ echo " Error: No completed '${ WORKFLOW_NAME} ' workflow runs found for commit ${ COMMIT_SHA} " >&2
7070 echo " Available workflow runs for this commit:" >&2
71- gh run list --repo " $REPOSITORY " --commit " $COMMIT_SHA " --limit 10 || true
71+ gh run list --repo " ${ REPOSITORY} " --commit " ${ COMMIT_SHA} " --limit 10 || true
7272 exit 1
7373fi
7474
7575# Filter for successful runs (conclusion = success) and extract the run ID from the first one
76- RUN_ID=$( echo " $RUN_DATA " | jq -r ' .[] | select(.conclusion == "success") | .databaseId' | head -1)
76+ RUN_ID=$( echo " ${ RUN_DATA} " | jq -r ' .[] | select(.conclusion == "success") | .databaseId' | head -1)
7777
78- if [[ -z " $RUN_ID " || " $RUN_ID " == " null" ]]; then
79- echo " Error: No successful '$WORKFLOW_NAME ' workflow runs found for commit $COMMIT_SHA " >&2
78+ if [[ -z " ${ RUN_ID} " || " ${ RUN_ID} " == " null" ]]; then
79+ echo " Error: No successful '${ WORKFLOW_NAME} ' workflow runs found for commit ${ COMMIT_SHA} " >&2
8080 echo " Available workflow runs for this commit:" >&2
81- gh run list --repo " $REPOSITORY " --commit " $COMMIT_SHA " --limit 10 || true
81+ gh run list --repo " $REPOSITORY " --commit " ${ COMMIT_SHA} " --limit 10 || true
8282 echo " " >&2
8383 echo " Completed runs with their conclusions:" >&2
84- echo " $RUN_DATA " | jq -r ' .[] | "\(.databaseId): \(.conclusion)"' >&2
84+ echo " ${ RUN_DATA} " | jq -r ' .[] | "\(.databaseId): \(.conclusion)"' >&2
8585 exit 1
8686fi
8787
88- echo " Found workflow run ID: $RUN_ID for tag '$GIT_TAG '" >&2
88+ echo " Found workflow run ID: ${ RUN_ID} for tag '${ GIT_TAG} '" >&2
8989
9090# Verify the run has the expected artifacts by checking if there are any artifacts
91- echo " Verifying artifacts exist for run $RUN_ID ..." >&2
92- ARTIFACT_LIST=$( gh run view " $RUN_ID " --repo " $REPOSITORY " --json url 2> /dev/null || echo " " )
91+ echo " Verifying artifacts exist for run ${ RUN_ID} ..." >&2
92+ ARTIFACT_LIST=$( gh run view " ${ RUN_ID} " --repo " ${ REPOSITORY} " --json url || echo " " )
9393
94- if [[ -z " $ARTIFACT_LIST " ]]; then
95- echo " Warning: Could not verify artifacts for workflow run $RUN_ID " >&2
94+ if [[ -z " ${ ARTIFACT_LIST} " ]]; then
95+ echo " Warning: Could not verify artifacts for workflow run ${ RUN_ID} " >&2
9696fi
9797
9898# Output the run ID (this is what gets used by calling scripts)
99- echo " $RUN_ID "
99+ echo " ${ RUN_ID} "
0 commit comments