Skip to content

Commit c6300d9

Browse files
authored
Clean up Gemini workflows and update dispatch (google#132)
* Clean up Gemini workflows and update dispatch * Prevent /review command on issues
1 parent 4db9191 commit c6300d9

4 files changed

Lines changed: 12 additions & 554 deletions

File tree

.github/workflows/gemini-dispatch.yml

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ on:
1111
types:
1212
- 'opened'
1313
- 'ready_for_review'
14-
issues:
15-
types:
16-
- 'opened'
17-
- 'reopened'
14+
1815
issue_comment:
1916
types:
2017
- 'created'
@@ -52,9 +49,6 @@ jobs:
5249
github.event_name == 'pull_request' &&
5350
github.event.pull_request.head.repo.fork == false &&
5451
github.event.pull_request.draft == false
55-
) || (
56-
github.event_name == 'issues' &&
57-
contains(fromJSON('["opened", "reopened"]'), github.event.action)
5852
) || (
5953
github.event.sender.type == 'User' &&
6054
startsWith(github.event.comment.body || github.event.review.body || github.event.issue.body, '@gemini-cli') &&
@@ -89,24 +83,24 @@ jobs:
8983
env:
9084
EVENT_TYPE: '${{ github.event_name }}.${{ github.event.action }}'
9185
REQUEST: '${{ github.event.comment.body || github.event.review.body || github.event.issue.body }}'
86+
IS_PR: '${{ !!(github.event.pull_request || github.event.issue.pull_request) }}'
9287
with:
9388
script: |
9489
const eventType = process.env.EVENT_TYPE;
9590
const request = process.env.REQUEST;
91+
const isPr = process.env.IS_PR === 'true';
9692
core.setOutput('request', request);
9793
9894
if (eventType === 'pull_request.opened') {
9995
core.setOutput('command', 'review');
100-
} else if (['issues.opened', 'issues.reopened'].includes(eventType)) {
101-
core.setOutput('command', 'triage');
10296
} else if (request.startsWith("@gemini-cli /review")) {
103-
core.setOutput('command', 'review');
104-
const additionalContext = request.replace(/^@gemini-cli \/review/, '').trim();
105-
core.setOutput('additional_context', additionalContext);
106-
} else if (request.startsWith("@gemini-cli /triage")) {
107-
core.setOutput('command', 'triage');
108-
} else if (request.startsWith("@gemini-cli /approve")) {
109-
core.setOutput('command', 'approve');
97+
if (isPr) {
98+
core.setOutput('command', 'review');
99+
const additionalContext = request.replace(/^@gemini-cli \/review/, '').trim();
100+
core.setOutput('additional_context', additionalContext);
101+
} else {
102+
core.setOutput('command', 'fallthrough');
103+
}
110104
} else if (request.startsWith("@gemini-cli")) {
111105
const additionalContext = request.replace(/^@gemini-cli/, '').trim();
112106
core.setOutput('command', 'invoke');
@@ -141,19 +135,7 @@ jobs:
141135
additional_context: '${{ needs.dispatch.outputs.additional_context }}'
142136
secrets: 'inherit'
143137

144-
triage:
145-
needs: 'dispatch'
146-
if: |-
147-
${{ needs.dispatch.outputs.command == 'triage' }}
148-
uses: './.github/workflows/gemini-triage.yml'
149-
permissions:
150-
contents: 'read'
151-
id-token: 'write'
152-
issues: 'write'
153-
pull-requests: 'write'
154-
with:
155-
additional_context: '${{ needs.dispatch.outputs.additional_context }}'
156-
secrets: 'inherit'
138+
157139

158140
invoke:
159141
needs: 'dispatch'
@@ -169,27 +151,13 @@ jobs:
169151
additional_context: '${{ needs.dispatch.outputs.additional_context }}'
170152
secrets: 'inherit'
171153

172-
plan-execute:
173-
needs: 'dispatch'
174-
if: |-
175-
${{ needs.dispatch.outputs.command == 'approve' }}
176-
uses: './.github/workflows/gemini-plan-execute.yml'
177-
permissions:
178-
contents: 'write'
179-
id-token: 'write'
180-
issues: 'write'
181-
pull-requests: 'write'
182-
with:
183-
additional_context: '${{ needs.dispatch.outputs.additional_context }}'
184-
secrets: 'inherit'
154+
185155

186156
fallthrough:
187157
needs:
188158
- 'dispatch'
189159
- 'review'
190-
- 'triage'
191160
- 'invoke'
192-
- 'plan-execute'
193161
if: |-
194162
${{ always() && !cancelled() && (failure() || needs.dispatch.outputs.command == 'fallthrough') }}
195163
runs-on: 'ubuntu-latest'

.github/workflows/gemini-plan-execute.yml

Lines changed: 0 additions & 130 deletions
This file was deleted.

0 commit comments

Comments
 (0)