Skip to content

Commit c1bd984

Browse files
Langleumaxdanilov
authored andcommitted
fix: retry-worfklow-run report back to workflow file
Before it was just taking the workflowName, which can be the correct fileName if a user doesn't overwrite the name. In that case it will default to the file name. The likelihood of users doing that is quite slim. Therefore, we need to get the correct file name somehow differently as the run itself doesn't contain that, we're parsing it via the api.
1 parent 4eacd6a commit c1bd984

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

.github/workflows/retry-worfklow-run.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,18 @@ jobs:
123123
RUN_ID: ${{ inputs.run-id }}
124124
run: |
125125
# trigger a new run with error notification
126-
workflow_name=$(
127-
gh run view "${RUN_ID}" \
128-
--json workflowName \
129-
--jq '.workflowName'
130-
)
126+
127+
path=$(gh api "/repos/${GH_REPO}/actions/runs/${RUN_ID}" \
128+
--jq '.path'
129+
)
130+
131+
workflow_name=$(basename "$path")
132+
131133
if [ "${DRY_RUN}" = "true" ]; then
132134
echo "Skipping notify back since this is a dry-run ..."
133135
else
134-
echo "notifying back to workflow=${workflow_name}.yml ..."
135-
gh workflow run "${workflow_name}.yml" \
136+
echo "notifying back to workflow=${workflow_name} ..."
137+
gh workflow run "${workflow_name}" \
136138
--field notify_back_error_message="${NOTIFY_BACK_ERROR_MESSAGE}" \
137139
--ref="${notify-back-git-ref}"
138140
fi

0 commit comments

Comments
 (0)