Skip to content

Commit 0c700e3

Browse files
committed
[chores] Improved CI failure bot caller
Added enhanced scoping and minor adjustments.
1 parent fbdc2cb commit 0c700e3

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

.github/workflows/bot-ci-failure.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ jobs:
3535
local pr_number="$1"
3636
local pr_author
3737
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login // empty' 2>/dev/null || echo "")
38-
if [ -z "$pr_author" ]; then
39-
pr_author="${{ github.event.workflow_run.actor.login }}"
40-
echo "::warning::Could not fetch PR author for PR #$pr_number; falling back to @$pr_author"
38+
if [ -z "$pr_author" ] || [ "$pr_author" = "null" ]; then
39+
echo "::warning::Could not fetch PR author for PR #$pr_number"
4140
fi
4241
echo "number=$pr_number" >> "$GITHUB_OUTPUT"
4342
echo "author=$pr_author" >> "$GITHUB_OUTPUT"
@@ -50,7 +49,7 @@ jobs:
5049
fi
5150
HEAD_SHA="$EVENT_HEAD_SHA"
5251
echo "Payload empty. Searching for PR via Commits API..."
53-
PR_NUMBER=$(gh api repos/$REPO/commits/$HEAD_SHA/pulls -q '[.[] | select(.state == "open")][0].number' 2>/dev/null || true)
52+
PR_NUMBER=$(gh api repos/$REPO/commits/$HEAD_SHA/pulls -q '.[0].number' 2>/dev/null || true)
5453
if [ -n "$PR_NUMBER" ] && [ "$PR_NUMBER" != "null" ]; then
5554
echo "Found PR #$PR_NUMBER using Commits API."
5655
emit_pr "$PR_NUMBER"

0 commit comments

Comments
 (0)