-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathaction.yml
More file actions
121 lines (111 loc) · 4.79 KB
/
action.yml
File metadata and controls
121 lines (111 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: 'Claude Code GitHub Action'
description: 'GitHub action for Claude Code Integration in PR comments'
branding:
icon: 'message-square'
color: 'purple'
inputs:
mode:
description: 'The mode to run the action in (review, suggest, suggest-review, issue-fix, issue-analyze, direct)'
required: true
default: 'review'
pr-number:
description: 'Pull request number (for PR-related modes)'
required: false
issue-number:
description: 'Issue number (for issue-fix mode)'
required: false
repo-owner:
description: 'Owner of the repository (for issue-fix mode)'
required: false
repo-name:
description: 'Name of the repository (for issue-fix mode)'
required: false
branch-prefix:
description: 'Prefix for the feature branch created for issue fixes'
required: false
default: 'fix'
issue-label:
description: 'Label that triggers issue fix workflows'
required: false
default: 'claude-fix'
debug-mode:
description: 'Enable full debug mode with shell tracing and Claude debug output'
required: false
default: 'false'
feedback:
description: 'The feedback text from the comment'
required: false
file-path:
description: 'Path to the file being reviewed (for suggest-review mode)'
required: false
line-number:
description: 'Line number in the file (for suggest-review mode)'
required: false
comment-id:
description: 'GitHub comment ID to reply to (for suggest-review mode)'
required: false
strict-mode:
description: 'Whether to strictly follow user requests without adding unrelated improvements'
required: false
default: 'true'
anthropic-api-key:
description: 'Anthropic API key for Claude access'
required: true
github-token:
description: 'GitHub token for API access'
required: true
output-file:
description: 'Path to write the output to (for direct mode)'
required: false
default: 'claude-code-output'
runs:
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup GitHub CLI
shell: bash
run: |
# Make sure GitHub CLI is available with token
echo "${{ inputs.github-token }}" | gh auth login --with-token
- name: Install Claude Code CLI
shell: bash
run: |
# Install Claude Code CLI
npm install -g @anthropic-ai/claude-code
- name: Process Review Request
if: inputs.mode == 'review' || inputs.mode == 'pr-comment'
shell: bash
run: |
chmod +x ${{ github.action_path }}/scripts/review-mode.sh
${{ github.action_path }}/scripts/review-mode.sh "${{ inputs.pr-number }}" "${{ inputs.feedback }}" "${{ inputs.anthropic-api-key }}" "${{ inputs.github-token }}"
- name: Process Suggested Changes
if: inputs.mode == 'suggest'
shell: bash
run: |
chmod +x ${{ github.action_path }}/scripts/suggest-mode.sh
${{ github.action_path }}/scripts/suggest-mode.sh "${{ inputs.pr-number }}" "${{ inputs.feedback }}" "${{ inputs.anthropic-api-key }}" "${{ inputs.github-token }}"
- name: Process Direct Request
if: inputs.mode == 'direct'
shell: bash
run: |
chmod +x ${{ github.action_path }}/scripts/direct-mode.sh
${{ github.action_path }}/scripts/direct-mode.sh "${{ inputs.feedback }}" "${{ inputs.anthropic-api-key }}" "${{ inputs.output-file }}"
- name: Process In-line Code Suggestions
if: inputs.mode == 'suggest-review'
shell: bash
run: |
chmod +x ${{ github.action_path }}/scripts/suggest-review-mode.sh
${{ github.action_path }}/scripts/suggest-review-mode.sh "${{ inputs.pr-number }}" "${{ inputs.feedback }}" "${{ inputs.file-path }}" "${{ inputs.line-number }}" "${{ inputs.comment-id }}" "${{ inputs.anthropic-api-key }}" "${{ inputs.github-token }}" "${{ inputs.strict-mode }}"
- name: Process Issue Fix
if: inputs.mode == 'issue-fix'
shell: bash
run: |
chmod +x ${{ github.action_path }}/scripts/issue-fix-mode.sh
${{ github.action_path }}/scripts/issue-fix-mode.sh "${{ inputs.issue-number }}" "${{ inputs.repo-owner }}" "${{ inputs.repo-name }}" "${{ inputs.branch-prefix }}" "${{ inputs.anthropic-api-key }}" "${{ inputs.github-token }}" "${{ inputs.issue-label }}" "${{ inputs.debug-mode }}" "${{ inputs.feedback }}"
- name: Process Issue Analysis
if: inputs.mode == 'issue-analyze'
shell: bash
run: |
chmod +x ${{ github.action_path }}/scripts/issue-analyze-mode.sh
${{ github.action_path }}/scripts/issue-analyze-mode.sh "${{ inputs.issue-number }}" "${{ inputs.repo-owner }}" "${{ inputs.repo-name }}" "${{ inputs.anthropic-api-key }}" "${{ inputs.github-token }}" "${{ inputs.debug-mode }}" "${{ inputs.feedback }}"