diff --git a/.github/workflows/claude-issue-response.yml b/.github/workflows/claude-issue-response.yml new file mode 100644 index 000000000..bc8db68fb --- /dev/null +++ b/.github/workflows/claude-issue-response.yml @@ -0,0 +1,62 @@ +name: Respond to @claude mentions in issues + +on: + issues: + types: [opened, edited] + issue_comment: + types: [created, edited] + +jobs: + claude-response: + runs-on: ubuntu-latest + permissions: + issues: write + contents: read + + steps: + - name: Check if @claude was mentioned + id: check_mention + run: | + BODY="${{ github.event.issue.body || github.event.comment.body }}" + if [[ "$BODY" == *"@claude"* ]]; then + echo "mentioned=true" >> $GITHUB_OUTPUT + else + echo "mentioned=false" >> $GITHUB_OUTPUT + fi + + - name: Respond to @claude mention + if: steps.check_mention.outputs.mentioned == 'true' + uses: actions/github-script@v7 + with: + script: | + const issue_number = context.issue.number; + const repo = context.repo.repo; + const owner = context.repo.owner; + + const body = github.event.issue?.body || github.event.comment?.body || ''; + + // Create a response comment + github.rest.issues.createComment({ + owner: owner, + repo: repo, + issue_number: issue_number, + body: `👋 Hey! I see you've mentioned @claude. + +To get Claude to help with this issue, I'm setting up a workflow to process your request. Please wait a moment... + +**Note**: The Claude GitHub App is installed and ready to help with: +- 🔍 Analyzing pull requests and issues +- 🐛 Fixing CI errors +- 📝 Reviewing code changes +- 🤖 Responding to development tasks + +Feel free to open a pull request or check back on this issue for updates!` + }); + + - name: Log issue details + if: steps.check_mention.outputs.mentioned == 'true' + run: | + echo "Issue #${{ github.event.issue.number }} mentioned @claude" + echo "Repository: ${{ github.repository }}" + echo "Issue Title: ${{ github.event.issue.title }}" + echo "Body: ${{ github.event.issue.body || github.event.comment.body }}"