# Setup triage automatico su un repository ## Prerequisiti - Gitea Actions abilitate sul repository - Issues abilitate sul repository - Runner disponibile con label `linux_amd64` (o label equivalente) - Accesso admin al repository per creare secrets e labels ## Passaggi ### 1. Secrets Crea i seguenti secrets nel repository (`Settings → Actions → Secrets`): | Secret | Valore | Descrizione | |---|---|---| | `TOKEN` | Token API Gitea | Permette all'action di applicare label e commentare | | `OPENCODE_API_KEY` | API key OpenCode | Autenticazione per il provider AI | ### 2. Labels Crea le label `bug` e `richiesta` (o verifica che esistano): ``` bug #ee0701 Malfunzionamento, errore, crash o anomalia richiesta #007bff Nuova funzionalità, miglioramento o ottimizzazione ``` Se il repo ha già label simili con nomi diversi, unificarle sulla versione minuscola per evitare ambiguità col triage. ### 3. Workflow Crea il file `.gitea/workflows/triage-issue.yml`: ```yaml name: Triage Issue on: issues: types: [opened] jobs: triage: runs-on: linux_amd64 steps: - uses: actions/checkout@v4 - uses: https://git.incloud.ovh/anuti/Actions/install-opencode@main - uses: https://git.incloud.ovh/anuti/Actions/triage-issue@main with: issue-title: ${{ github.event.issue.title }} issue-body: ${{ github.event.issue.body }} issue-number: ${{ github.event.issue.number }} repository: ${{ github.repository }} api-token: ${{ secrets.TOKEN }} api-key: ${{ secrets.OPENCODE_API_KEY }} ``` Se il runner ha una label diversa da `linux_amd64`, modificare `runs-on` di conseguenza. ### 4. Commit e push ```bash git add .gitea/workflows/triage-issue.yml git commit -m "Aggiunge workflow triage automatico" git push ``` ### 5. Test Aprire una nuova issue sul repository. Entro pochi secondi il runner dovrebbe: 1. Classificare l'issue come `bug` o `richiesta` 2. Applicare la label corrispondente 3. Pubblicare un commento con riassunto, gap analisi e domande aperte 4. Caricare un file `.md` con l'analisi tecnica completa come asset dell'issue ### Troubleshooting **Il workflow non parte** - Verificare che `has_actions: true` sul repository (API: `PATCH /repos/{owner}/{repo}` con body `{"has_actions":true}`) - Verificare che il runner sia online e abbia la label corretta **Errore "secret not found"** - Verificare che i secrets `TOKEN` e `OPENCODE_API_KEY` siano configurati **Label non trovata** - Il triage cerca label con nome esattamente `bug` e `richiesta`. Crearle se mancanti.