1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Claude Code Actionsを使って自動でissueにラベルを付与する

1
Posted at

Claude Code Actionsは定額プランでも使用できるのでissueが開かれたら自動でラベルを付与するようにしてみました。

.github/workflows/issue-triage.yml

name: Issue Triage
on:
  issues:
    types: [opened]

jobs:
  triage:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
    steps:
      - name: Checkout code
        uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - name: Setup git identity
        run: |
          git config --global user.email "claude[bot]@users.noreply.github.com"
          git config --global user.name "claude[bot]"

      - name: Get Labels
        id: get_labels
        uses: actions/github-script@v8
        with:
          github-token: ${{ github.token }}
          script: |
            const { data } = await github.rest.issues.listLabelsForRepo({
              owner: context.repo.owner,
              repo: context.repo.repo
            });

            return data.map(label => `${label.name}: ${label.description || 'No description'}`).join('\n');

      - name: Issue Triage with Claude
        id: claude
        uses: anthropics/claude-code-action@v1.0.70
        with:
          prompt: |
            Analyze this issue and determine the appropriate label.

            Available labels:
            ${{ steps.get_labels.outputs.result }}

            Issue #${{ github.event.issue.number }}: ${{ github.event.issue.title }}

            update issue command: gh issue edit ${{ github.event.issue.number }} --add-label "$LABEL"

            ${{ github.event.issue.body }}
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
          claude_args: "--allowedTools 'Bash(gh issue edit:*)'"

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?