Skip to content

Trigger only on "READY TO REVIEW" label#18

Merged
neonspectra merged 6 commits intomainfrom
neon/label-trigger-only-on-rtr2
Feb 6, 2026
Merged

Trigger only on "READY TO REVIEW" label#18
neonspectra merged 6 commits intomainfrom
neon/label-trigger-only-on-rtr2

Conversation

@neonspectra
Copy link
Copy Markdown
Collaborator

The current version of the workflow triggers on any label applied; we only want this to trigger on "READY TO REVIEW" items.

@neonspectra neonspectra self-assigned this Feb 5, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 1 correctness issue. Consider addressing the suggestions in the comments.

Comment thread action.yml Outdated
Comment on lines 116 to 135
@@ -123,12 +124,13 @@ runs:
PR_NUMBER="$PR_NUMBER"
CACHE_HIT="${{ steps.claudecode-history.outputs.cache-hit }}"

# Check if required label is present
if [ -n "$REQUIRE_LABEL" ]; then
# Check label requirement only for 'labeled' trigger
# Other triggers (opened, synchronize, reopened) run without label check
if [ "$EVENT_ACTION" == "labeled" ] && [ -n "$REQUIRE_LABEL" ]; then
if echo "$PR_LABELS" | jq -e --arg label "$REQUIRE_LABEL" 'index($label) != null' > /dev/null 2>&1; then
echo "Required label '$REQUIRE_LABEL' found on PR #$PR_NUMBER"
echo "Required label '$REQUIRE_LABEL' found on PR #$PR_NUMBER (triggered by label addition)"
else
echo "Skipping code review: required label '$REQUIRE_LABEL' not found on PR #$PR_NUMBER"
echo "Skipping code review: 'labeled' trigger requires label '$REQUIRE_LABEL', but it was not the label added"
ENABLE_CLAUDECODE="false"
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Code Review Finding: Label check doesn't verify which label was added

Severity: MEDIUM
Category: correctness

Impact: When any label is added to a PR that already has the required label, the review will run even though a different label was added. The error message "it was not the label added" is misleading since the code doesn't check which label was added.

Recommendation: To check the actual label added, use github.event.label.name instead. Pass it as an environment variable (e.g., ADDED_LABEL: ${{ github.event.label.name }}) and compare it to REQUIRE_LABEL.

Suggested change
ADDED_LABEL: ${{ github.event.label.name }}
run: |
# Check if ClaudeCode should be enabled
ENABLE_CLAUDECODE="true"
SILENCE_CLAUDECODE_COMMENTS="false"
# For PRs, check sampling and cache
if [ "${{ github.event_name }}" == "pull_request" ]; then
PR_NUMBER="$PR_NUMBER"
CACHE_HIT="${{ steps.claudecode-history.outputs.cache-hit }}"
# Check label requirement only for 'labeled' trigger
# Other triggers (opened, synchronize, reopened) run without label check
if [ "$EVENT_ACTION" == "labeled" ] && [ -n "$REQUIRE_LABEL" ]; then
if [ "$ADDED_LABEL" == "$REQUIRE_LABEL" ]; then
echo "Required label '$REQUIRE_LABEL' added to PR #$PR_NUMBER (triggered by label addition)"
else
echo "Skipping code review: 'labeled' trigger requires label '$REQUIRE_LABEL', but '$ADDED_LABEL' was added"
ENABLE_CLAUDECODE="false"
fi
fi

@neonspectra
Copy link
Copy Markdown
Collaborator Author

neonspectra commented Feb 5, 2026

@matej How exactly do you want the labeled trigger to function?

As-is, it procs every time a label is applied (regardless of what that label is). I don't think that's the behaviour we want.

The way I see it, there's one of two options:

  • Option 1 - We check if the READY TO REVIEW label is present before performing any code review (including the on-PR-opened check that is currently set to happen)
  • Option 2 - We only check the READY TO REVIEW label for when the labeled trigger is what triggers the action, so the RTR label only matters for the labeled trigger.

IMO option 2 is better because it better accounts for letting the stuff run on manual trigger for debugging. But also since we have the on_PR trigger happening, it also means we would trigger a code review when the PR is first opened (and maybe we want that? Thoughts?)

@neonspectra neonspectra requested a review from matej February 5, 2026 22:58
Comment thread .github/workflows/code-review.yml Outdated
@matej
Copy link
Copy Markdown
Member

matej commented Feb 6, 2026

The intention is that no review is performed at all if the label is not present. So it always needs to be check. If I open a PR and this label is not present then we're considering it a draft PR and are not requesting code review. Once the label is applied we want an immediate code review but we also want to re-review on any new commit. That is effectively how the label works in the Nutrient monorepo.

@neonspectra neonspectra merged commit 4671d49 into main Feb 6, 2026
2 checks passed
@neonspectra neonspectra deleted the neon/label-trigger-only-on-rtr2 branch February 6, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants