# Auto-labels new issues and PRs using mux.
# SETUP: Add ANTHROPIC_API_KEY to repository secrets.
# Fork PRs are skipped (no secret access).
name: Auto-Label
on:
issues:
types: [opened]
pull_request:
types: [opened]
permissions:
issues: write
pull-requests: write
jobs:
label:
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@b7a1c7ccf290d58743029c4f6903da283811b979 # v2.1.0
- name: Label with mux
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TYPE: ${{ github.event_name == 'pull_request' && 'pr' || 'issue' }}
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
run: |
[ -z "$ANTHROPIC_API_KEY" ] && echo "Skipping (no API key)" && exit 0
bunx mux@next run --budget 0.50 "
Label this GitHub $TYPE using ONLY existing labels. Steps:
1. gh label list --json name,description
2. gh $TYPE view $NUMBER
3. gh $TYPE edit $NUMBER --add-label <labels>
Pick 1-3 labels from the list in step 1. Do NOT create new labels.
If no existing labels fit well, skip step 3.
"