Skip to content

Commit 2c053ac

Browse files
committed
fix(ci): harden agentic auth failure comments
Signed-off-by: Andre Manoel <amanoel@nvidia.com>
1 parent 650f95a commit 2c053ac

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

.github/workflows/authorize-agentic-ci.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ jobs:
4242
;;
4343
*)
4444
gh api --method POST "repos/${REPO}/issues/${PR_NUMBER}/comments" \
45-
-f body="Only maintainers with write access can authorize Agentic CI checks." >/dev/null
45+
-f body="Only maintainers with write access can authorize Agentic CI checks." >/dev/null || \
46+
echo "::warning::Unable to post permission failure comment."
4647
exit 1
4748
;;
4849
esac
@@ -91,13 +92,17 @@ jobs:
9192
run: |
9293
comment() {
9394
gh api --method POST "repos/${REPO}/issues/${PR_NUMBER}/comments" \
94-
-f body="$1" >/dev/null
95+
-f body="$1" >/dev/null || \
96+
echo "::warning::Unable to post authorization failure comment."
9597
}
9698
9799
comment_file() {
98-
jq -n --rawfile body "$1" '{body: $body}' > /tmp/agentic-ci-auth-comment.json
100+
tmp=$(mktemp)
101+
trap 'rm -f "$tmp"' RETURN
102+
jq -n --rawfile body "$1" '{body: $body}' > "$tmp"
99103
gh api --method POST "repos/${REPO}/issues/${PR_NUMBER}/comments" \
100-
--input /tmp/agentic-ci-auth-comment.json >/dev/null
104+
--input "$tmp" >/dev/null || \
105+
echo "::warning::Unable to post authorization failure comment."
101106
}
102107
103108
if [ "$STATE" != "open" ]; then

0 commit comments

Comments
 (0)