-
Notifications
You must be signed in to change notification settings - Fork 175
56 lines (51 loc) · 1.79 KB
/
triage-issue.yml
File metadata and controls
56 lines (51 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Issue Triage with Gemini
on:
issues:
types: [opened, edited]
pull_request:
workflow_dispatch:
inputs:
title:
description: 'Mock Issue Title'
default: 'Test Issue'
body:
description: 'Mock Issue Body'
default: 'This is a test issue description.'
jobs:
triage:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Run Triage Script
id: run_script
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
ISSUE_TITLE: ${{ github.event.issue.title || github.event.pull_request.title || github.event.inputs.title }}
ISSUE_BODY: ${{ github.event.issue.body || github.event.pull_request.body || github.event.inputs.body }}
run: |
labels=$(python .github/scripts/triage_issue.py)
echo "labels=$labels" >> $GITHUB_OUTPUT
- name: Apply Labels
if: steps.run_script.outputs.labels != '' && (github.event.issue.number || github.event.pull_request.number)
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
run: |
# Convert comma-separated labels to gh command arguments
IFS=',' read -ra ADDR <<< "${{ steps.run_script.outputs.labels }}"
for i in "${ADDR[@]}"; do
# Trim whitespace and only add if not empty
label=$(echo "$i" | xargs)
if [ -n "$label" ]; then
gh issue edit "$ISSUE_NUMBER" --add-label "$label"
fi
done