Skip to content

Commit d727cc0

Browse files
committed
Add configurable issue label and debug mode options
1 parent ca0586a commit d727cc0

File tree

4 files changed

+29
-7
lines changed

4 files changed

+29
-7
lines changed

.github/workflows/claude-issue-fix.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
jobs:
88
process-issue-fix:
99
runs-on: ubuntu-latest
10-
# Only run on issues with the 'claude-fix' label
10+
# Run on issues with the configured label (default: 'claude-fix')
1111
if: ${{ github.event.label.name == 'claude-fix' }}
1212
permissions:
1313
contents: write
@@ -38,6 +38,8 @@ jobs:
3838
# Use github.event.repository.name for just the repo name (without owner)
3939
repo-name: ${{ github.event.repository.name }}
4040
branch-prefix: 'fix'
41+
issue-label: 'claude-fix'
42+
debug-mode: 'false'
4143
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
4244
github-token: ${{ secrets.GITHUB_TOKEN }}
4345

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ jobs:
105105
| `repo-owner` | Owner of the repository (for issue-fix mode) | Yes*** | |
106106
| `repo-name` | Name of the repository (for issue-fix mode) | Yes*** | |
107107
| `branch-prefix` | Prefix for the feature branch created for issue fixes | No | `fix` |
108+
| `issue-label` | Label that triggers issue fix workflows | No | `claude-fix` |
109+
| `debug-mode` | Enable full debug mode with shell tracing and Claude debug output | No | `false` |
108110
| `strict-mode` | Whether to strictly follow user requests without adding unrelated improvements | No | `true` |
109111
| `anthropic-api-key` | Anthropic API key | Yes | |
110112
| `github-token` | GitHub token | Yes | |
@@ -243,11 +245,13 @@ jobs:
243245
repo-owner: ${{ github.repository_owner }}
244246
repo-name: ${{ github.event.repository.name }}
245247
branch-prefix: 'fix'
248+
issue-label: 'claude-fix'
249+
debug-mode: 'false'
246250
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
247251
github-token: ${{ secrets.GITHUB_TOKEN }}
248252
```
249253

250-
This workflow is triggered when an issue is labeled with "claude-fix". Only repo maintainers with write access can add this label, providing security control.
254+
This workflow is triggered when an issue is labeled with the configured label (default: "claude-fix"). You can customize this label using the `issue-label` parameter. Only repo maintainers with write access can add this label, providing security control.
251255

252256
## License
253257

action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ inputs:
2525
description: 'Prefix for the feature branch created for issue fixes'
2626
required: false
2727
default: 'fix'
28+
issue-label:
29+
description: 'Label that triggers issue fix workflows'
30+
required: false
31+
default: 'claude-fix'
32+
debug-mode:
33+
description: 'Enable full debug mode with shell tracing and Claude debug output'
34+
required: false
35+
default: 'false'
2836
feedback:
2937
description: 'The feedback text from the comment'
3038
required: false
@@ -103,4 +111,4 @@ runs:
103111
shell: bash
104112
run: |
105113
chmod +x ${{ github.action_path }}/scripts/issue-fix-mode.sh
106-
${{ 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 }}"
114+
${{ 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 }}"

scripts/issue-fix-mode.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@
22
# Enable strict error checking
33
set -e
44

5-
# Enable debug mode for shell script
6-
set -x
7-
85
# Get input parameters
96
ISSUE_NUMBER=$1
107
REPO_OWNER=$2
118
REPO_NAME=$3
129
BRANCH_PREFIX=$4
1310
ANTHROPIC_API_KEY=$5
1411
GITHUB_TOKEN=$6
12+
ISSUE_LABEL=${7:-"claude-fix"}
13+
DEBUG_MODE=${8:-"false"}
14+
15+
# Enable debug mode if requested
16+
if [[ "$DEBUG_MODE" == "true" ]]; then
17+
set -x
18+
CLAUDE_DEBUG_FLAG="-d"
19+
echo "Debug mode enabled"
20+
else
21+
CLAUDE_DEBUG_FLAG=""
22+
fi
1523

1624
# Validate required inputs
1725
if [ -z "$ISSUE_NUMBER" ]; then
@@ -147,7 +155,7 @@ echo "Prompt saved to $PROMPT_FILE for debugging"
147155
# Run Claude with specific allowed tools
148156
CLAUDE_OUTPUT_FILE="$OUTPUT_DIR/claude_output_$ISSUE_NUMBER.txt"
149157
echo "Running Claude to fix the issue..."
150-
if ! claude -p "$CLAUDE_PROMPT" --allowedTools "Bash(git diff:*)" "Bash(git log:*)" Edit > "$CLAUDE_OUTPUT_FILE" 2>"$OUTPUT_DIR/claude_error_$ISSUE_NUMBER.log"; then
158+
if ! claude -p $CLAUDE_DEBUG_FLAG "$CLAUDE_PROMPT" --allowedTools "Bash(git diff:*)" "Bash(git log:*)" Edit > "$CLAUDE_OUTPUT_FILE" 2>"$OUTPUT_DIR/claude_error_$ISSUE_NUMBER.log"; then
151159
echo "Error: Claude execution failed"
152160
cat "$OUTPUT_DIR/claude_error_$ISSUE_NUMBER.log"
153161
exit 1

0 commit comments

Comments
 (0)