Skip to content

Commit ddfca16

Browse files
committed
Revert "only check for label on labeled trigger"
This reverts commit 0f4a2fa.
1 parent 0f4a2fa commit ddfca16

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ This action is not hardened against prompt injection attacks and should only be
6767
| `custom-security-scan-instructions` | Path to custom security scan instructions text file to append to the security section | None | No |
6868
| `dismiss-stale-reviews` | Dismiss previous bot reviews when posting a new review (useful for follow-up commits) | `true` | No |
6969
| `skip-draft-prs` | Skip code review on draft pull requests | `true` | No |
70-
| `require-label` | When set, the `labeled` trigger only runs if this specific label was added. Other triggers (`opened`, `synchronize`, `reopened`) always run regardless. Add `labeled` to your workflow `pull_request` types to enable on-demand reviews via label. | None | No |
70+
| `require-label` | Only run review if this label is present. Leave empty to review all PRs. Add `labeled` to your workflow `pull_request` types to trigger on label addition. | None | No |
7171

7272
### Action Outputs
7373

action.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ inputs:
6464
default: 'true'
6565

6666
require-label:
67-
description: 'When set, the "labeled" trigger will only run if this specific label was added. Other triggers (opened, synchronize, reopened) always run regardless of this setting. Add "labeled" to your workflow pull_request types to enable on-demand reviews via label.'
67+
description: 'Only run review if this label is present on the PR. Leave empty to review all PRs. To trigger on label addition, add "labeled" to your workflow pull_request types.'
6868
required: false
6969
default: ''
7070

@@ -113,7 +113,6 @@ runs:
113113
IS_DRAFT: ${{ github.event.pull_request.draft }}
114114
REQUIRE_LABEL: ${{ inputs.require-label }}
115115
PR_LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }}
116-
EVENT_ACTION: ${{ github.event.action }}
117116
run: |
118117
# Check if ClaudeCode should be enabled
119118
ENABLE_CLAUDECODE="true"
@@ -124,13 +123,12 @@ runs:
124123
PR_NUMBER="$PR_NUMBER"
125124
CACHE_HIT="${{ steps.claudecode-history.outputs.cache-hit }}"
126125
127-
# Check label requirement only for 'labeled' trigger
128-
# Other triggers (opened, synchronize, reopened) run without label check
129-
if [ "$EVENT_ACTION" == "labeled" ] && [ -n "$REQUIRE_LABEL" ]; then
126+
# Check if required label is present
127+
if [ -n "$REQUIRE_LABEL" ]; then
130128
if echo "$PR_LABELS" | jq -e --arg label "$REQUIRE_LABEL" 'index($label) != null' > /dev/null 2>&1; then
131-
echo "Required label '$REQUIRE_LABEL' found on PR #$PR_NUMBER (triggered by label addition)"
129+
echo "Required label '$REQUIRE_LABEL' found on PR #$PR_NUMBER"
132130
else
133-
echo "Skipping code review: 'labeled' trigger requires label '$REQUIRE_LABEL', but it was not the label added"
131+
echo "Skipping code review: required label '$REQUIRE_LABEL' not found on PR #$PR_NUMBER"
134132
ENABLE_CLAUDECODE="false"
135133
fi
136134
fi

0 commit comments

Comments
 (0)