|
| 1 | +name: Auto Triage Issues |
| 2 | + |
| 3 | +on: |
| 4 | + # Triage newly opened or reopened issues immediately |
| 5 | + issues: |
| 6 | + types: [opened, reopened] |
| 7 | + |
| 8 | + # Daily sweep to catch anything missed (e.g., label removals, edits) |
| 9 | + schedule: |
| 10 | + - cron: "0 9 * * *" # 9:00 UTC daily |
| 11 | + |
| 12 | + # Allow manual runs from the Actions tab |
| 13 | + workflow_dispatch: |
| 14 | + inputs: |
| 15 | + issue_number: |
| 16 | + description: "Triage a specific issue number (leave empty for all untriaged)" |
| 17 | + required: false |
| 18 | + type: string |
| 19 | + dry_run: |
| 20 | + description: "Dry-run mode (preview only, don't apply labels)" |
| 21 | + required: false |
| 22 | + type: boolean |
| 23 | + default: false |
| 24 | + |
| 25 | +permissions: |
| 26 | + issues: write |
| 27 | + |
| 28 | +jobs: |
| 29 | + triage: |
| 30 | + name: Triage Issues |
| 31 | + runs-on: ubuntu-latest |
| 32 | + timeout-minutes: 10 |
| 33 | + |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} |
| 37 | + TRIAGE_MODEL: ${{ vars.TRIAGE_MODEL || 'gpt-4o-mini' }} |
| 38 | + |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v6 |
| 41 | + |
| 42 | + - name: Install jq |
| 43 | + run: sudo apt-get install -y jq |
| 44 | + |
| 45 | + - name: Triage single issue (on issue event) |
| 46 | + if: github.event_name == 'issues' |
| 47 | + run: | |
| 48 | + ./scripts/triage-new-issues.sh \ |
| 49 | + --issue ${{ github.event.issue.number }} \ |
| 50 | + --apply |
| 51 | +
|
| 52 | + - name: Triage specific issue (manual dispatch) |
| 53 | + if: >- |
| 54 | + github.event_name == 'workflow_dispatch' |
| 55 | + && github.event.inputs.issue_number != '' |
| 56 | + run: | |
| 57 | + ARGS=(--issue ${{ github.event.inputs.issue_number }}) |
| 58 | + if [[ "${{ github.event.inputs.dry_run }}" != "true" ]]; then |
| 59 | + ARGS+=(--apply) |
| 60 | + fi |
| 61 | + ./scripts/triage-new-issues.sh "${ARGS[@]}" |
| 62 | +
|
| 63 | + - name: Triage all untriaged issues (schedule or manual sweep) |
| 64 | + if: >- |
| 65 | + github.event_name == 'schedule' |
| 66 | + || (github.event_name == 'workflow_dispatch' |
| 67 | + && github.event.inputs.issue_number == '') |
| 68 | + run: | |
| 69 | + ARGS=() |
| 70 | + if [[ "${{ github.event.inputs.dry_run }}" != "true" ]]; then |
| 71 | + ARGS+=(--apply) |
| 72 | + fi |
| 73 | + ./scripts/triage-new-issues.sh "${ARGS[@]}" |
0 commit comments