Skip to content

Commit 7f836ef

Browse files
authored
Only match on latest approval (#28)
1 parent 8b63356 commit 7f836ef

File tree

1 file changed

+5
-3
lines changed
  • .github/actions/get-github-workflow-approver

1 file changed

+5
-3
lines changed

.github/actions/get-github-workflow-approver/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ runs:
5353
--data-urlencode "per_page=${PER_PAGE}" \
5454
--data-urlencode "page=${PAGE}" \
5555
"$API_URL" > audit.json
56-
56+
5757
MATCH_ENTRY=$(jq -r --arg run_id ${{ github.run_id }} '
58-
.[] | select(.workflow_run_id == ($run_id | tonumber))' audit.json)
58+
[.[] | select(.workflow_run_id == ($run_id | tonumber))]
59+
| sort_by(."@timestamp")
60+
| last
61+
' audit.json)
5962
6063
if [[ -n "$MATCH_ENTRY" ]]; then
6164
echo "Found matching approval:"
@@ -67,7 +70,6 @@ runs:
6770
fi
6871
done
6972
70-
7173
if [[ -z "$APPROVER" ]]; then
7274
echo "No approval found for workflow_run_id: $WORKFLOW_RUN_ID"
7375
exit 1

0 commit comments

Comments
 (0)