Skip to content

Commit 2a01a23

Browse files
committed
Add support for "dev: no-bot-comments"
1 parent 40b4ec1 commit 2a01a23

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/pr-comment.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,19 @@ jobs:
7676
echo "workflow_run_id=${{ github.event.workflow_run.id }}" >> $GITHUB_OUTPUT
7777
fi
7878
79+
- name: Check if PR has 'dev: no-bot-comments' label
80+
if: ${{ github.event_name == 'workflow_dispatch' || (steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
81+
id: check-label
82+
run: |
83+
has_label=$(gh pr view "${{ steps.set-vars.outputs.pr_number }}" --json labels -q \
84+
'.labels[].name' | grep -Fxq "dev: no-bot-comments" && echo "true" || echo "false")
85+
echo "has_label=$has_label" >> "$GITHUB_OUTPUT"
86+
env:
87+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88+
7989
# This step runs in both cases using the proper variables.
8090
- name: ghprcomment@main
81-
if: ${{ github.event_name == 'workflow_dispatch' || (steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true') }}
91+
if: ${{ steps.check-label.outputs.has_label == 'false' && (github.event_name == 'workflow_dispatch' || (steps.read-pr_number.outputs.pr_number != '' && steps.isCrossRepository.outputs.isCrossRepository == 'true')) }}
8292
uses: jbangdev/[email protected]
8393
with:
8494
script: https://github.com/koppor/ghprcomment/blob/main/ghprcomment.java

0 commit comments

Comments
 (0)