Skip to content

Commit f5f23c4

Browse files
committed
[chores] Improved scoping
Updated ci failure bot for enhancements and scoping.
1 parent a47c3ef commit f5f23c4

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818
jobs:
1919
find-pr:
2020
runs-on: ubuntu-latest
21-
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
21+
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }}
2222
outputs:
2323
pr_number: ${{ steps.pr.outputs.number }}
2424
pr_author: ${{ steps.pr.outputs.author }}
@@ -34,10 +34,9 @@ jobs:
3434
emit_pr() {
3535
local pr_number="$1"
3636
local pr_author
37-
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login' 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"
37+
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login // empty' 2>/dev/null || echo "")
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"
@@ -70,9 +69,9 @@ jobs:
7069
needs: find-pr
7170
if: ${{ needs.find-pr.outputs.pr_number != '' }}
7271
permissions:
73-
actions: read
74-
contents: read
7572
pull-requests: write
73+
actions: write
74+
contents: read
7675
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-ci-failure.yml@master
7776
with:
7877
pr_number: ${{ needs.find-pr.outputs.pr_number }}

0 commit comments

Comments
 (0)