name: Auto Label on: pull_request_target: types: [opened, synchronize] issues: types: [opened, edited] # #14051 Tier B: label runs are pure metadata — a superseded label pass on the # same PR/issue is worthless. Cancel the in-flight run when a new event lands so # rapid pushes don't pile up 70+ queued Auto Label runs on the fleet. Group by # PR number (or issue number) so PR and issue lanes never collide. concurrency: group: auto-label-${{ github.event.pull_request.number || github.event.issue.number || github.ref }} cancel-in-progress: true permissions: contents: read pull-requests: write issues: write jobs: label-pr: if: github.event_name == 'pull_request_target' runs-on: ${{ fromJSON(vars.HETZNER_FLEET_ONLINE == 'false' && '["ubuntu-24.04"]' || '["self-hosted","hetzner-robot"]') }} steps: - uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" pr-number: "${{ github.event.pull_request.number }}" label-issue: if: github.event_name == 'issues' runs-on: ${{ fromJSON(vars.HETZNER_FLEET_ONLINE == 'false' && '["ubuntu-24.04"]' || '["self-hosted","hetzner-robot"]') }} steps: - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 with: script: | const title = context.payload.issue.title.toLowerCase(); const body = (context.payload.issue.body || '').toLowerCase(); const text = title + ' ' + body; const labels = []; if (text.includes('crash') || text.includes('error') || text.includes('bug') || text.includes('broken') || text.includes('regression')) { labels.push('bug'); } if (text.includes('security') || text.includes('vulnerability') || text.includes('cve') || text.includes('injection')) { labels.push('security'); } if (text.includes('performance') || text.includes('slow') || text.includes('memory leak') || text.includes('latency')) { labels.push('performance'); } if (text.includes('telegram') || text.includes('discord') || text.includes('connector')) { labels.push('connector'); } if (text.includes('memory') || text.includes('context') || text.includes('rag')) { labels.push('memory'); } if (text.includes('plugin')) { labels.push('plugin'); } if (labels.length > 0) { await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, labels: labels }); }