Skip to content

Commit 8fc89b4

Browse files
matejclaude
andcommitted
Add skip-draft-prs option to skip reviews on draft PRs
New input `skip-draft-prs` (default: true): - true: Skip code review on draft pull requests - false: Review all PRs including drafts Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent cf5997b commit 8fc89b4

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

action.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ inputs:
5858
required: false
5959
default: 'true'
6060

61+
skip-draft-prs:
62+
description: 'Skip code review on draft pull requests'
63+
required: false
64+
default: 'true'
65+
6166
outputs:
6267
findings-count:
6368
description: 'Number of code review findings'
@@ -99,19 +104,25 @@ runs:
99104
env:
100105
PR_NUMBER: ${{ github.event.pull_request.number }}
101106
RUN_EVERY_COMMIT: ${{ inputs.run-every-commit }}
107+
SKIP_DRAFT_PRS: ${{ inputs.skip-draft-prs }}
108+
IS_DRAFT: ${{ github.event.pull_request.draft }}
102109
run: |
103110
# Check if ClaudeCode should be enabled
104111
ENABLE_CLAUDECODE="true"
105112
SILENCE_CLAUDECODE_COMMENTS="false"
106-
113+
107114
# For PRs, check sampling and cache
108115
if [ "${{ github.event_name }}" == "pull_request" ]; then
109116
PR_NUMBER="$PR_NUMBER"
110117
CACHE_HIT="${{ steps.claudecode-history.outputs.cache-hit }}"
111118
119+
# Skip draft PRs if configured
120+
if [ "$SKIP_DRAFT_PRS" == "true" ] && [ "$IS_DRAFT" == "true" ]; then
121+
echo "Skipping code review for draft PR #$PR_NUMBER"
122+
ENABLE_CLAUDECODE="false"
112123
# Now check cache - if ClaudeCode has already run, disable unless run-every-commit is true
113124
# Check if marker file exists (cache may have been restored from a different SHA)
114-
if [ "$RUN_EVERY_COMMIT" != "true" ] && [ -f ".claudecode-marker/marker.json" ]; then
125+
elif [ "$RUN_EVERY_COMMIT" != "true" ] && [ -f ".claudecode-marker/marker.json" ]; then
115126
echo "ClaudeCode has already run on PR #$PR_NUMBER (found marker file), forcing disable to avoid false positives"
116127
ENABLE_CLAUDECODE="false"
117128
elif [ "$RUN_EVERY_COMMIT" == "true" ] && [ -f ".claudecode-marker/marker.json" ]; then

0 commit comments

Comments
 (0)