From 3f7dd4a2b0361e146d1bdb9f650ee361efa795e6 Mon Sep 17 00:00:00 2001 From: sbijarnia-eightfold <133695142+sbijarnia-eightfold@users.noreply.github.com> Date: Wed, 22 Oct 2025 19:12:40 +0530 Subject: [PATCH] Add Claude Code GitHub Action workflow --- .github/workflows/test_claude_action.yml | 73 ++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/test_claude_action.yml diff --git a/.github/workflows/test_claude_action.yml b/.github/workflows/test_claude_action.yml new file mode 100644 index 0000000..b7dac6f --- /dev/null +++ b/.github/workflows/test_claude_action.yml @@ -0,0 +1,73 @@ +name: Claude Code - Rebase & Merge +on: + issue_comment: + types: [created] + pull_request_review_comment: + types: [created] + issues: + types: [opened, assigned] + pull_request_review: + types: [submitted] + + +jobs: + claude: + if: | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, 'merge-master')) || + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, 'merge-master')) || + (github.event_name == 'pull_request_review' && contains(github.event.review.body, 'merge-master')) || + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, 'merge-master'))) + runs-on: ubuntu-latest + permissions: + contents: write + 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@v5 + with: + fetch-depth: 1 + + - name: Run Claude Code + id: claude + uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + prompt: | + @agent-code-reviewer + **GitHub PR Context:** + - Repository: ${{ github.repository }} + - PR Number: ${{ github.event.pull_request.number }} + - Base Branch: ${{ github.event.pull_request.base.ref }} + - Head Branch: ${{ github.event.pull_request.head.ref }} + - PR Title: ${{ github.event.pull_request.title }} + + **Your Task:** + Base branch is master, You need to merge latest master branch into PR branch, + Resolve if there are any merge conflicts while merging. + Note: Do not push any changes to master branch, only push to PR branch if conflicts are resolved + + claude_args: "--allowedTools 'Edit,MultiEdit,Write,Read,Glob,Grep,LS,Bash(git:*),Bash(bun:*),Bash(npm:*),Bash(npx:*),Bash(gh:*)'" + + # Optional: Customize the trigger phrase (default: @claude) + # trigger_phrase: "/claude" + + # Optional: Trigger when specific user is assigned to an issue + # assignee_trigger: "claude-bot" + + # Optional: Configure Claude's behavior with CLI arguments + # claude_args: | + # --model claude-opus-4-1-20250805 + # --max-turns 10 + # --allowedTools "Bash(npm install),Bash(npm run build),Bash(npm run test:*),Bash(npm run lint:*)" + # --system-prompt "Follow our coding standards. Ensure all new code has tests. Use TypeScript for new files." + + # Optional: Advanced settings configuration + # settings: | + # { + # "env": { + # "NODE_ENV": "test" + # } + # }