Skip to content

Conversation

@BenGWeeks
Copy link
Contributor

  • Remove automatic trigger on pull_request events
  • Add workflow_dispatch for manual UI trigger with PR number input
  • Add issue_comment trigger for /claude-review command on PRs
  • Add step to dynamically determine PR number from trigger source

- Remove automatic trigger on pull_request events
- Add workflow_dispatch for manual UI trigger with PR number input
- Add issue_comment trigger for /claude-review command on PRs
- Add step to dynamically determine PR number from trigger source
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR converts the Claude Code Review workflow from automatic triggering on pull requests to manual triggering. The workflow can now be triggered either through the GitHub Actions UI with a PR number input, or via a /claude-review command in PR comments.

Key changes:

  • Replaced automatic pull_request trigger with manual workflow_dispatch and issue_comment triggers
  • Added conditional job execution to filter for PR comments with the trigger phrase
  • Implemented dynamic PR number extraction based on the trigger source

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 17 to 20
# Only run on PR comments (not issue comments) with trigger phrase, or on manual dispatch
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.issue.pull_request && contains(github.event.comment.body, '/claude-review'))
Copy link

Copilot AI Jan 4, 2026

Choose a reason for hiding this comment

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

The issue_comment trigger allows any user to trigger this workflow by commenting on a PR. This could be a security concern if you want to restrict who can trigger code reviews. Consider adding a permission check in the if condition to verify that the commenter has appropriate permissions (e.g., checking github.actor against an allowed list, or verifying github.event.comment.author_association is OWNER, MEMBER, or COLLABORATOR).

Suggested change
# Only run on PR comments (not issue comments) with trigger phrase, or on manual dispatch
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.issue.pull_request && contains(github.event.comment.body, '/claude-review'))
# Only run on PR comments (not issue comments) with trigger phrase from authorized users, or on manual dispatch
if: |
github.event_name == 'workflow_dispatch' ||
(
github.event.issue.pull_request &&
contains(github.event.comment.body, '/claude-review') &&
(
github.event.comment.author_association == 'OWNER' ||
github.event.comment.author_association == 'MEMBER' ||
github.event.comment.author_association == 'COLLABORATOR'
)
)

Copilot uses AI. Check for mistakes.
Address GitHub Copilot security feedback by restricting the issue_comment
trigger to authorized users only (OWNER, MEMBER, COLLABORATOR). This
prevents unauthorized users from consuming workflow resources.
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