Skip to content

Commit e4b0716

Browse files
authored
Fix triage workflow (#233)
1 parent 2a49059 commit e4b0716

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

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

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ on:
99
- 'release/**/*'
1010
paths:
1111
- '.github/workflows/gemini-issue-scheduled-triage.yml'
12+
push:
13+
branches:
14+
- 'main'
15+
- 'release/**/*'
16+
paths:
17+
- '.github/workflows/gemini-issue-scheduled-triage.yml'
1218
workflow_dispatch:
1319

1420
concurrency:
@@ -30,7 +36,7 @@ jobs:
3036
pull-requests: 'read'
3137
outputs:
3238
available_labels: '${{ steps.get_labels.outputs.available_labels }}'
33-
triaged_issues: '${{ steps.gemini_issue_analysis.outputs.triaged_issues }}'
39+
triaged_issues: '${{ env.TRIAGED_ISSUES }}'
3440
steps:
3541
- name: 'Get repository labels'
3642
id: 'get_labels'
@@ -58,6 +64,7 @@ jobs:
5864
id: 'find_issues'
5965
env:
6066
GITHUB_REPOSITORY: '${{ github.repository }}'
67+
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN || github.token }}'
6168
run: |-
6269
echo '🔍 Finding unlabeled issues and issues marked for triage...'
6370
ISSUES="$(gh issue list \
@@ -105,7 +112,8 @@ jobs:
105112
},
106113
"coreTools": [
107114
"run_shell_command(echo)",
108-
"run_shell_command(jq)"
115+
"run_shell_command(jq)",
116+
"run_shell_command(printenv)"
109117
]
110118
}
111119
prompt: |-
@@ -185,7 +193,7 @@ jobs:
185193
186194
Assemble the results into a single JSON array, formatted as a string, according to the **Output Specification** below. Finally, execute the command to write this string to the output file, ensuring the JSON is enclosed in single quotes to prevent shell interpretation.
187195
188-
- `Run: echo 'triaged_issues=...' > "${OUTPUT_PATH}"`. (Replace `...` with the final, minified JSON array string).
196+
- `Run: echo 'TRIAGED_ISSUES=...' > "${OUTPUT_PATH}"`. (Replace `...` with the final, minified JSON array string).
189197
190198
## Output Specification
191199
@@ -242,7 +250,6 @@ jobs:
242250

243251
- name: 'Apply labels'
244252
env:
245-
ISSUE_NUMBER: '${{ github.event.issue.number }}'
246253
AVAILABLE_LABELS: '${{ needs.triage.outputs.available_labels }}'
247254
TRIAGED_ISSUES: '${{ needs.triage.outputs.triaged_issues }}'
248255
uses: 'actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea' # ratchet:actions/github-script@v7.0.1
@@ -257,18 +264,21 @@ jobs:
257264
.sort()
258265
259266
// Parse out the triaged issues
260-
const triagedIssues = (process.env.AVAILABLE_LABELS || {})
267+
const triagedIssues = (JSON.parse(process.env.TRIAGED_ISSUES || '{}'))
261268
.sort((a, b) => a.issue_number - b.issue_number)
262269
270+
core.debug(`Triaged issues: ${JSON.stringify(triagedIssues)}`);
271+
263272
// Iterate over each label
264273
for (const issue of triagedIssues) {
265274
if (!issue) {
275+
core.debug(`Skipping empty issue: ${JSON.stringify(issue)}`);
266276
continue;
267277
}
268278
269-
const issueNumber = issue.issue_Number;
279+
const issueNumber = issue.issue_number;
270280
if (!issueNumber) {
271-
core.debug(`Skipping issue with no data: ${JSON.stringify(entry)}`);
281+
core.debug(`Skipping issue with no data: ${JSON.stringify(issue)}`);
272282
continue;
273283
}
274284
@@ -279,6 +289,8 @@ jobs:
279289
.filter((label) => availableLabels.includes(label))
280290
.sort()
281291
292+
core.debug(`Identified labels to set: ${JSON.stringify(labelsToSet)}`);
293+
282294
if (labelsToSet.length === 0) {
283295
core.info(`Skipping issue #${issueNumber} - no labels to set.`)
284296
continue;

0 commit comments

Comments
 (0)