Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/bot-ci-failure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
- completed

permissions:
pull-requests: write
actions: write
pull-requests: read
actions: read
contents: read

concurrency:
Expand All @@ -34,8 +34,8 @@ jobs:
emit_pr() {
local pr_number="$1"
local pr_author
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login' 2>/dev/null || echo "")
if [ -z "$pr_author" ]; then
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login // empty' 2>/dev/null || echo "")
if [ -z "$pr_author" ] || [ "$pr_author" = "null" ]; then
echo "::warning::Could not fetch PR author for PR #$pr_number"
fi
echo "number=$pr_number" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -68,6 +68,10 @@ jobs:
call-ci-failure-bot:
needs: find-pr
if: ${{ needs.find-pr.outputs.pr_number != '' }}
permissions:
pull-requests: write
actions: write
contents: read
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-ci-failure.yml@master
with:
pr_number: ${{ needs.find-pr.outputs.pr_number }}
Expand Down
12 changes: 8 additions & 4 deletions docs/developer/reusable-github-utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ job:
- completed

permissions:
pull-requests: write
actions: write
pull-requests: read
actions: read
contents: read

concurrency:
Expand All @@ -410,8 +410,8 @@ job:
emit_pr() {
local pr_number="$1"
local pr_author
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login' 2>/dev/null || echo "")
if [ -z "$pr_author" ]; then
pr_author=$(gh pr view "$pr_number" --repo "$REPO" --json author --jq '.author.login // empty' 2>/dev/null || echo "")
if [ -z "$pr_author" ] || [ "$pr_author" = "null" ]; then
echo "::warning::Could not fetch PR author for PR #$pr_number"
fi
echo "number=$pr_number" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -444,6 +444,10 @@ job:
call-ci-failure-bot:
needs: find-pr
if: ${{ needs.find-pr.outputs.pr_number != '' }}
permissions:
pull-requests: write
actions: write
contents: read
uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-ci-failure.yml@master
with:
pr_number: ${{ needs.find-pr.outputs.pr_number }}
Expand Down
Loading