Skip to content

Commit 093d38d

Browse files
authored
Refactor find_run function to handle multiple RUN_IDs
1 parent ba070df commit 093d38d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/publish.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,15 @@ jobs:
8989
9090
find_run() {
9191
local WF=$1
92-
gh api "repos/${{ github.repository }}/actions/workflows/$WF/runs?branch=$BRANCH&per_page=20" \
93-
--jq ".workflow_runs[] | select(.conclusion == \"success\") | .id" 2>/dev/null | \
94-
while read RUN_ID; do
92+
local RUN_IDS
93+
RUN_IDS=$(gh api "repos/${{ github.repository }}/actions/workflows/$WF/runs?branch=$BRANCH&per_page=20" \
94+
--jq ".workflow_runs[] | select(.conclusion == \"success\") | .id")
95+
for RUN_ID in $RUN_IDS; do
9596
INPUT_TAG=$(gh api "repos/${{ github.repository }}/actions/runs/$RUN_ID" --jq '.inputs.tag // ""' 2>/dev/null)
96-
[ "$INPUT_TAG" = "$TAG" ] && echo "$RUN_ID" && return
97+
if [ "$INPUT_TAG" = "$TAG" ]; then
98+
echo "$RUN_ID"
99+
return
100+
fi
97101
done
98102
}
99103

0 commit comments

Comments
 (0)