Skip to content

Commit edb8fe1

Browse files
JeromeJuyukivx
andauthored
support issue_comment, label and workflow_dispatch triggers for issue triage (#10)
This commit adds supports for all needed triggers for issue triage workflows. Co-authored-by: aliciatang07 <tangalicia@google.com>
1 parent 26a5d4d commit edb8fe1

3 files changed

Lines changed: 48 additions & 12 deletions

File tree

.github/workflows/gemini-issue-automated-triage.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ on:
55
types:
66
- 'opened'
77
- 'reopened'
8+
issue_comment:
9+
types:
10+
- 'created'
11+
workflow_dispatch:
12+
inputs:
13+
issue_number:
14+
description: 'issue number to triage'
15+
required: true
16+
type: 'number'
817

918
concurrency:
1019
group: '${{ github.workflow }}-${{ github.event.issue.number }}'
@@ -22,6 +31,14 @@ permissions:
2231

2332
jobs:
2433
triage-issue:
34+
if: >
35+
github.event_name == 'issues' ||
36+
github.event_name == 'workflow_dispatch' ||
37+
(github.event_name == 'issue_comment' &&
38+
contains(github.event.comment.body, '@gemini-cli /triage') &&
39+
(github.event.comment.author_association == 'OWNER' ||
40+
github.event.comment.author_association == 'MEMBER' ||
41+
github.event.comment.author_association == 'COLLABORATOR'))
2542
timeout-minutes: 5
2643
runs-on: 'ubuntu-latest'
2744

docs/issue-triage.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,28 +18,30 @@ graph TD
1818
A[Issue Opened or Reopened]
1919
B[Scheduled Cron Job]
2020
C[Manual Dispatch]
21+
D[Issue Comment with '@gemini-cli /triage' Created]
2122
end
2223
2324
subgraph "Gemini CLI on GitHub"
24-
D[Get Issue Details]
25-
E{Issue needs triage?}
26-
F[Analyze Issue with Gemini]
27-
G[Apply Labels]
25+
E[Get Issue Details]
26+
F{Issue needs triage?}
27+
G[Analyze Issue with Gemini]
28+
H[Apply Labels]
2829
end
2930
30-
A --> D
31-
B --> D
32-
C --> D
31+
A --> E
32+
B --> E
33+
C --> E
3334
D --> E
34-
E -- Yes --> F
35-
F --> G
36-
E -- No --> J((End))
37-
G --> J
35+
E --> F
36+
F -- Yes --> G
37+
G --> H
38+
F -- No --> J((End))
39+
H --> J
3840
```
3941

4042
The two workflows work together to ensure that all new and existing issues are triaged in a timely manner.
4143

42-
1. **Real-Time Triage**: When a new issue is opened or reopened, a GitHub Actions workflow is triggered. This workflow uses the Gemini CLI to analyze the issue and apply the most appropriate labels. This provides immediate feedback and categorization of new issues.
44+
1. **Real-Time Triage**: When a new issue is opened or reopened, an issue comment that contains `@gemini-cli /triage` is created or when a maintainer of the repo dispatch the triage event, a GitHub Actions workflow is triggered. This workflow uses the Gemini CLI to analyze the issue and apply the most appropriate labels. This provides immediate feedback and categorization of new issues.
4345

4446
2. **Scheduled Triage**: To catch any issues that might have been missed by the real-time triage, a scheduled workflow runs every hour. This workflow specifically looks for issues that have no labels or have the `status/needs-triage` label. This ensures that all issues are eventually triaged.
4547

examples/gemini-issue-automated-triage.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ on:
55
types:
66
- 'opened'
77
- 'reopened'
8+
issue_comment:
9+
types:
10+
- 'created'
11+
workflow_dispatch:
12+
inputs:
13+
issue_number:
14+
description: 'issue number to triage'
15+
required: true
16+
type: 'number'
817

918
concurrency:
1019
group: '${{ github.workflow }}-${{ github.event.issue.number }}'
@@ -22,6 +31,14 @@ permissions:
2231

2332
jobs:
2433
triage-issue:
34+
if: >
35+
github.event_name == 'issues' ||
36+
github.event_name == 'workflow_dispatch' ||
37+
(github.event_name == 'issue_comment' &&
38+
contains(github.event.comment.body, '@gemini-cli /triage') &&
39+
(github.event.comment.author_association == 'OWNER' ||
40+
github.event.comment.author_association == 'MEMBER' ||
41+
github.event.comment.author_association == 'COLLABORATOR'))
2542
timeout-minutes: 5
2643
runs-on: 'ubuntu-latest'
2744

0 commit comments

Comments
 (0)