1212 description : " PR number to review"
1313 required : true
1414 type : number
15+
16+ # TEMPORARY: For testing in PR - REMOVE THIS after merging to main
17+ pull_request :
18+ types : [opened, synchronize, reopened]
1519
1620# Minimal permissions needed
1721permissions :
@@ -22,20 +26,36 @@ permissions:
2226jobs :
2327 # Check if the comment trigger should run the review
2428 check-comment :
25- if : github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/review')
29+ if : |
30+ (github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/review')) ||
31+ github.event_name == 'pull_request' ||
32+ github.event_name == 'workflow_dispatch'
2633 runs-on : ubuntu-latest
2734 outputs :
2835 should_run : ${{ steps.check.outputs.result }}
29- pr_number : ${{ github.event.issue.number }}
36+ pr_number : ${{ steps.get-pr.outputs.pr_number }}
3037
3138 steps :
39+ - name : Get PR number
40+ id : get-pr
41+ run : |
42+ if [ "${{ github.event_name }}" == "pull_request" ]; then
43+ echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
44+ elif [ "${{ github.event_name }}" == "issue_comment" ]; then
45+ echo "pr_number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT
46+ elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
47+ echo "pr_number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT
48+ fi
49+
3250 - name : Check comment conditions
3351 id : check
3452 run : |
35- echo "Comment body: ${{ github.event.comment.body }}"
53+ echo "Event: ${{ github.event_name }}"
54+ echo "PR Number: ${{ steps.get-pr.outputs.pr_number }}"
3655 echo "result=true" >> $GITHUB_OUTPUT
3756
3857 - name : Add reaction to comment
58+ if : github.event_name == 'issue_comment'
3959 uses : actions/github-script@v7
4060 with :
4161 script : |
@@ -49,15 +69,13 @@ jobs:
4969 # Run the actual review process
5070 run-review :
5171 needs : [check-comment]
52- if : |
53- always() &&
54- (needs.check-comment.outputs.should_run == 'true' || github.event_name == 'workflow_dispatch')
72+ if : always() && needs.check-comment.outputs.should_run == 'true'
5573 runs-on : ubuntu-latest
5674 steps :
5775 - name : Checkout repository
58- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
76+ uses : actions/checkout@v4
5977 with :
60- ref : ${{ teps.pr-details.outputs. head_ref }}
78+ ref : ${{ github.event_name == 'pull_request' && github. head_ref || '' }}
6179
6280 - name : Run PR Reviewer Agent
6381 id : review
0 commit comments