Skip to content

Commit a579461

Browse files
authored
feat: sync issue triage workflow with dogfooding (#58)
This commit synchronizes the issue triage workflow with the version used in dogfooding. The main changes are: - Pinning the actions to a specific commit hash to ensure stability. - Adding a step to post a comment on the issue if the triage fails. <!-- Thank you for proposing a pull request! Please note that SOME TESTS WILL LIKELY FAIL due to how GitHub exposes secrets in Pull Requests from forks. Someone from the team will review your Pull Request and respond. Please describe your change and any implementation details below. -->
1 parent 38dc231 commit a579461

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

workflows/issue-triage/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Alternatively, you can manually copy the contents of the workflow files from thi
7373

7474
This workflow is defined in `workflows/issue-triage/gemini-issue-automated-triage.yml` and is triggered when an issue is opened or reopened. It uses the Gemini CLI to analyze the issue and apply relevant labels.
7575

76+
If the triage process encounters an error, the workflow will post a comment on the issue, including a link to the action logs for debugging.
77+
7678
### Scheduled Issue Triage
7779

7880
This workflow is defined in `workflows/issue-triage/gemini-issue-scheduled-triage.yml` and runs on a schedule (e.g., every hour). It finds any issues that have no labels or have the `status/needs-triage` label and then uses the Gemini CLI to triage them. This workflow can also be manually triggered.

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,20 @@ jobs:
4444

4545
steps:
4646
- name: 'Checkout repository'
47-
uses: 'actions/checkout@v4'
47+
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # ratchet:actions/checkout@v4
4848

4949
- name: 'Generate GitHub App Token'
5050
id: 'generate_token'
5151
if: |-
5252
${{ vars.APP_ID }}
53-
uses: 'actions/create-github-app-token@v1'
53+
uses: 'actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e' # ratchet:actions/create-github-app-token@v2
5454
with:
5555
app-id: '${{ vars.APP_ID }}'
5656
private-key: '${{ secrets.APP_PRIVATE_KEY }}'
5757

5858
- name: 'Run Gemini Issue Triage'
5959
uses: 'google-github-actions/run-gemini-cli@main'
60+
id: 'gemini_issue_triage'
6061
env:
6162
GITHUB_TOKEN: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
6263
ISSUE_TITLE: '${{ github.event.issue.title }}'
@@ -113,3 +114,17 @@ jobs:
113114
- Triage only the current issue
114115
- Assign all applicable labels based on the issue content
115116
- Reference all shell variables as "${VAR}" (with quotes and braces)
117+
118+
- name: 'Post Issue Triage Failure Comment'
119+
if: |-
120+
${{ failure() && steps.gemini_issue_triage.outcome == 'failure' }}
121+
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea'
122+
with:
123+
github-token: '${{ steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}'
124+
script: |
125+
github.rest.issues.createComment({
126+
owner: '${{ github.repository }}'.split('/')[0],
127+
repo: '${{ github.repository }}'.split('/')[1],
128+
issue_number: '${{ github.event.issue.number }}',
129+
body: 'There is a problem with the Gemini CLI issue triaging. Please check the [action logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) for details.'
130+
})

0 commit comments

Comments
 (0)