diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 3b3656a2a..fc6ccfbf9 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -12,12 +12,13 @@ on: jobs: claude-review: - # Optional: Filter by PR author - # if: | - # github.event.pull_request.user.login == 'external-contributor' || - # github.event.pull_request.user.login == 'new-developer' || - # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' - + # Skip if: + # - PR is from a fork (secrets are not available) + # - PR is from a bot (workflow validation may fail) + if: | + github.event.pull_request.head.repo.full_name == github.repository && + github.event.pull_request.user.type != 'Bot' + runs-on: ubuntu-latest permissions: contents: read @@ -63,5 +64,5 @@ jobs: # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md # or https://docs.claude.com/en/docs/claude-code/cli-reference for available options - claude_args: '--allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' + claude_args: '--model opus --allowed-tools "mcp__github_inline_comment__create_inline_comment,Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' diff --git a/.github/workflows/claude-issue-similar.yml b/.github/workflows/claude-issue-similar.yml new file mode 100644 index 000000000..094176e81 --- /dev/null +++ b/.github/workflows/claude-issue-similar.yml @@ -0,0 +1,75 @@ +name: Claude Similar Issues + +on: + issues: + types: [opened] + +jobs: + find-similar: + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + issues: write + + steps: + - name: Checkout repository + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + with: + fetch-depth: 1 + + - name: Find Similar Issues + uses: anthropics/claude-code-action@6902c227aaa9536481b99d56f3014bbbad6c6da8 # v1.0.18 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + allowed_non_write_users: "*" + claude_args: '--model opus --allowed-tools "Bash(gh issue view:*),Bash(gh issue comment:*),Bash(gh search:*)"' + prompt: | + You're an assistant that finds similar issues in the repository. + + Issue Information: + - REPO: ${{ github.repository }} + - ISSUE_NUMBER: ${{ github.event.issue.number }} + + TASK: + + 1. First, get the current issue details: + ``` + gh issue view ${{ github.event.issue.number }} + ``` + + 2. Search for similar issues using keywords from the title and body: + - Use `gh search issues` with relevant keywords + - Search in this repository only: `repo:${{ github.repository }}` + - Exclude the current issue from results + - Look for both open and closed issues + + 3. Analyze the search results and select up to 3 most relevant similar issues: + - Consider title similarity + - Consider problem description similarity + - Prioritize issues that might help the user (solved issues, related discussions) + + 4. If you find relevant similar issues (1-3), post a helpful comment: + - Use `gh issue comment ${{ github.event.issue.number }} --body "..."` + - Format the comment nicely with links to the similar issues + - Briefly explain why each issue might be related + - Use this format: + + ``` + ### Related Issues + + I found some similar issues that might be helpful: + + - #123 - [Title] - Brief reason why it's related + - #456 - [Title] - Brief reason why it's related + + These might provide additional context or solutions. + ``` + + 5. If NO similar issues are found, do NOT post any comment. Simply end the task. + + IMPORTANT: + - Maximum 3 similar issues + - Only comment if you find genuinely related issues + - Do NOT comment if no similar issues are found + - Be concise in your explanations diff --git a/.github/workflows/claude-issue-triage.yml b/.github/workflows/claude-issue-triage.yml new file mode 100644 index 000000000..6ae95b16e --- /dev/null +++ b/.github/workflows/claude-issue-triage.yml @@ -0,0 +1,75 @@ +name: Claude Issue Triage + +on: + issues: + types: [opened] + +jobs: + triage-issue: + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + issues: write + + steps: + - name: Checkout repository + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + with: + fetch-depth: 1 + + - name: Run Claude Issue Triage + uses: anthropics/claude-code-action@6902c227aaa9536481b99d56f3014bbbad6c6da8 # v1.0.18 + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + allowed_non_write_users: "*" + claude_args: '--model opus --allowed-tools "Bash(gh label list:*),Bash(gh issue view:*),Bash(gh issue edit:*),Bash(gh search:*)"' + prompt: | + You're an issue triage assistant for the Repomix repository. Your task is to analyze the issue and select appropriate labels from the repository's label list. + + IMPORTANT: Don't post any comments or messages to the issue. Your only action should be to apply labels. + + Issue Information: + - REPO: ${{ github.repository }} + - ISSUE_NUMBER: ${{ github.event.issue.number }} + + TASK OVERVIEW: + + 1. First, fetch the list of labels available in this repository by running: `gh label list`. Run exactly this command with nothing else. + + 2. Next, use gh commands to get context about the issue: + - Use `gh issue view ${{ github.event.issue.number }}` to retrieve the current issue's details + - Use `gh search issues` to find similar issues that might provide context for proper categorization + + 3. Analyze the issue content, considering: + - The issue title and description + - The type of issue (bug report, feature request, question, etc.) + - Technical areas mentioned (output formats, language parsing, MCP server, security, CLI options, etc.) + - User impact and severity + + 4. Select appropriate labels from the available labels: + - Choose labels that accurately reflect the issue's nature + - Common categories for Repomix: + - `bug`: Something isn't working correctly + - `enhancement`: New feature or improvement request + - `question`: User needs help or clarification + - `documentation`: Documentation improvements needed + - `needs investigation`: Requires deeper analysis to understand + - `needs more information`: Issue lacks details to proceed + - `needs discussion`: Requires team discussion before action + - `good first issue`: Suitable for new contributors + - `idea`: Early-stage feature concept + - If you find similar OPEN issues using gh search, consider using the `duplicate` label + + 5. Apply the selected labels: + - Use `gh issue edit ${{ github.event.issue.number }} --add-label "label1,label2"` to apply your selected labels + - DO NOT post any comments explaining your decision + - DO NOT communicate directly with users + - If no labels are clearly applicable, do not apply any labels + + IMPORTANT GUIDELINES: + - Be thorough in your analysis + - Only select labels from the repository's available labels + - DO NOT post any comments to the issue + - Your ONLY action should be to apply labels using gh issue edit + - It's okay to not add any labels if none are clearly applicable diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index 6904f26fd..b8481d6c8 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -43,8 +43,7 @@ jobs: # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. # prompt: 'Update the pull request description to include a summary of changes.' - # Optional: Add claude_args to customize behavior and configuration # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md # or https://docs.claude.com/en/docs/claude-code/sdk#command-line for available options - # claude_args: '--model claude-opus-4-1-20250805 --allowed-tools Bash(gh pr:*)' + claude_args: '--model opus'