Skip to content

Task 3: Add updated prompt solution and workflow automation #12

Task 3: Add updated prompt solution and workflow automation

Task 3: Add updated prompt solution and workflow automation #12

Workflow file for this run

name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
# Prevent abuse - limit concurrent Claude requests
concurrency:
group: claude-${{ github.event.issue.number || github.event.pull_request.number }}
cancel-in-progress: false
jobs:
claude:
if: |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
contents: write # Changed from read to write (enables reactions)
pull-requests: write
issues: write
id-token: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# This is an optional setting that allows Claude to read CI results on PRs
additional_permissions: |
actions: read
# 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/cli-reference for available options
# claude_args: '--allowed-tools Bash(gh pr:*)'
# Optional: Enable REVIEW-ONLY mode (uncomment to restrict Claude from making code changes)
# prompt: |
# **IMPORTANT - REVIEW ONLY MODE**
# You are in REVIEW-ONLY mode. Provide guidance and analysis WITHOUT making code changes.
# ✅ You SHOULD: Review code, provide suggestions, answer questions, read files
# ❌ You MUST NOT: Make code changes, create/modify files, create PRs/commits
# ---
# User request: ${{ github.event.comment.body || github.event.issue.body || github.event.review.body }}
# claude_args: '--allowed-tools "Bash(gh issue:*),Bash(gh pr:*),Bash(gh search:*),Read,Glob,Grep,WebFetch,WebSearch"'
- name: Notify on failure
if: failure()
run: |
if [ "${{ github.event_name }}" == "issue_comment" ] || [ "${{ github.event_name }}" == "issues" ]; then
gh issue comment ${{ github.event.issue.number }} --body "⚠️ @claude encountered an error processing your request. Please check the [Actions log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) or try again."
elif [ "${{ github.event_name }}" == "pull_request_review_comment" ] || [ "${{ github.event_name }}" == "pull_request_review" ]; then
gh pr comment ${{ github.event.pull_request.number }} --body "⚠️ @claude encountered an error processing your request. Please check the [Actions log](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) or try again."
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}