1- ---
21name : ' 🧐 Gemini Pull Request Review'
32
4- on : # yamllint disable-line rule:truthy
3+ on :
54 pull_request :
65 types :
76 - ' opened'
@@ -18,9 +17,24 @@ on: # yamllint disable-line rule:truthy
1817 required : true
1918 type : ' number'
2019
20+ concurrency :
21+ group : ' ${{ github.workflow }}-${{ github.head_ref || github.ref }}'
22+ cancel-in-progress : true
23+
24+ defaults :
25+ run :
26+ shell : ' bash'
27+
28+ permissions :
29+ contents : ' read'
30+ id-token : ' write'
31+ issues : ' write'
32+ pull-requests : ' write'
33+ statuses : ' write'
34+
2135jobs :
2236 review-pr :
23- if : >
37+ if : |-
2438 github.event_name == 'workflow_dispatch' ||
2539 (github.event_name == 'pull_request' && github.event.action == 'opened') ||
2640 (github.event_name == 'issue_comment' && github.event.issue.pull_request &&
@@ -49,35 +63,30 @@ jobs:
4963 )
5064 timeout-minutes : 15
5165 runs-on : ' ubuntu-latest'
52- permissions :
53- contents : ' read'
54- id-token : ' write'
55- pull-requests : ' write'
56- issues : ' write'
66+
5767 steps :
5868 - name : ' Checkout PR code'
59- uses : ' actions/checkout@v4'
60- with :
61- fetch-depth : 0
69+ uses : ' actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # ratchet:actions/checkout@v4
6270
6371 - name : ' Generate GitHub App Token'
6472 id : ' generate_token'
65- if : ${{ vars.APP_ID }}
66- uses : ' actions/create-github-app-token@v1'
73+ if : |-
74+ ${{ vars.APP_ID }}
75+ uses : ' actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e' # ratchet:actions/create-github-app-token@v2
6776 with :
6877 app-id : ' ${{ vars.APP_ID }}'
6978 private-key : ' ${{ secrets.APP_PRIVATE_KEY }}'
7079
7180 - name : ' Get PR details (pull_request & workflow_dispatch)'
7281 id : ' get_pr'
73- if : github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
82+ if : |-
83+ ${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }}
7484 env :
7585 GITHUB_TOKEN : ' ${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
76- EVENT_NAME : " ${{ github.event_name }}"
77- WORKFLOW_PR_NUMBER : " ${{ github.event.inputs.pr_number }}"
78- PULL_REQUEST_NUMBER : " ${{ github.event.pull_request.number }}"
79- shell : bash
80- run : |
86+ EVENT_NAME : ' ${{ github.event_name }}'
87+ WORKFLOW_PR_NUMBER : ' ${{ github.event.inputs.pr_number }}'
88+ PULL_REQUEST_NUMBER : ' ${{ github.event.pull_request.number }}'
89+ run : |-
8190 set -euo pipefail
8291
8392 if [[ "${EVENT_NAME}" = "workflow_dispatch" ]]; then
@@ -103,13 +112,13 @@ jobs:
103112
104113 - name : ' Get PR details (issue_comment)'
105114 id : ' get_pr_comment'
106- if : github.event_name == 'issue_comment'
115+ if : |-
116+ ${{ github.event_name == 'issue_comment' }}
107117 env :
108118 GITHUB_TOKEN : ' ${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
109- COMMENT_BODY : " ${{ github.event.comment.body }}"
110- PR_NUMBER : " ${{ github.event.issue.number }}"
111- shell : bash
112- run : |
119+ COMMENT_BODY : ' ${{ github.event.comment.body }}'
120+ PR_NUMBER : ' ${{ github.event.issue.number }}'
121+ run : |-
113122 set -euo pipefail
114123
115124 echo "pr_number=${PR_NUMBER}" >> "${GITHUB_OUTPUT}"
@@ -136,17 +145,17 @@ jobs:
136145 uses : ' ./'
137146 env :
138147 GITHUB_TOKEN : ' ${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
139- PR_NUMBER : " ${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number }}"
140- PR_DATA : " ${{ steps.get_pr.outputs.pr_data || steps.get_pr_comment.outputs.pr_data }}"
141- CHANGED_FILES : " ${{ steps.get_pr.outputs.changed_files || steps.get_pr_comment.outputs.changed_files }}"
142- ADDITIONAL_INSTRUCTIONS : " ${{ steps.get_pr.outputs.additional_instructions || steps.get_pr_comment.outputs.additional_instructions }}"
143- REPOSITORY : " ${{ github.repository }}"
148+ PR_NUMBER : ' ${{ steps.get_pr.outputs.pr_number || steps.get_pr_comment.outputs.pr_number }}'
149+ PR_DATA : ' ${{ steps.get_pr.outputs.pr_data || steps.get_pr_comment.outputs.pr_data }}'
150+ CHANGED_FILES : ' ${{ steps.get_pr.outputs.changed_files || steps.get_pr_comment.outputs.changed_files }}'
151+ ADDITIONAL_INSTRUCTIONS : ' ${{ steps.get_pr.outputs.additional_instructions || steps.get_pr_comment.outputs.additional_instructions }}'
152+ REPOSITORY : ' ${{ github.repository }}'
144153 GEMINI_CLI_VERSION : ' ${{ vars.GEMINI_CLI_VERSION }}'
145154 OTLP_GOOGLE_CLOUD_PROJECT : ' ${{ vars.OTLP_GOOGLE_CLOUD_PROJECT }}'
146155 OTLP_GCP_WIF_PROVIDER : ' ${{ vars.OTLP_GCP_WIF_PROVIDER }}'
147156 GEMINI_API_KEY : ' ${{ secrets.GEMINI_API_KEY }}'
148157 with :
149- settings_json : |
158+ settings_json : |-
150159 {
151160 "coreTools": [
152161 "run_shell_command(echo)",
@@ -165,7 +174,7 @@ jobs:
165174 },
166175 "sandbox": false
167176 }
168- prompt : |
177+ prompt : |-
169178 ## Role
170179
171180 You are an expert code reviewer. You have access to tools to gather
0 commit comments