feat: add more pw error cases to troubleshoot [red-89] #64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Claude Code Issue Automation | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| issue_comment: | |
| types: [created] | |
| jobs: | |
| claude-respond: | |
| if: contains(github.event.issue.body, '@claude') || contains(github.event.comment.body, '@claude') | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| actions: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Claude Code | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| # Install Claude Code | |
| curl -fsSL https://claude.ai/install.sh | bash | |
| # Get issue content | |
| ISSUE_BODY="${{ github.event.issue.body || github.event.comment.body }}" | |
| ISSUE_NUMBER="${{ github.event.issue.number }}" | |
| ISSUE_TITLE="${{ github.event.issue.title }}" | |
| # Create branch name | |
| BRANCH_NAME="claude/issue-${ISSUE_NUMBER}" | |
| # Configure git | |
| git config user.name "Claude Code Bot" | |
| git config user.email "claude@anthropic.com" | |
| # Create and checkout new branch | |
| git checkout -b "$BRANCH_NAME" | |
| # Show current directory structure for debugging | |
| echo "Current working directory: $(pwd)" | |
| echo "Directory contents:" | |
| ls -la | |
| # Run Claude Code with the issue content and explicit working directory context | |
| claude --permission-mode bypassPermissions -p "Work on GitHub issue #${ISSUE_NUMBER} in the docs repository. Current working directory is the root of the checkly/docs repo. Please complete all requested changes automatically without asking for permission. Issue details: ${ISSUE_BODY}" || { | |
| echo "Claude Code execution failed with exit code $?" | |
| echo "Checking if any changes were made anyway..." | |
| } | |
| # Check what files were changed | |
| echo "Git status after Claude Code execution:" | |
| git status | |
| echo "Git diff after Claude Code execution:" | |
| git diff --name-only | |
| echo "Checking if target file exists:" | |
| ls -la docs/communicate/alerts/configuration.mdx | |
| # Commit and push changes if any were made | |
| if ! git diff --quiet HEAD; then | |
| echo "Changes detected, committing and pushing..." | |
| git add -A | |
| git commit -m "Fix issue #${ISSUE_NUMBER}: Replace Card components with normal headers" \ | |
| -m "Generated with Claude Code" \ | |
| -m "Co-Authored-By: Claude <noreply@anthropic.com>" | |
| git push -u origin "$BRANCH_NAME" | |
| # Create PR | |
| gh pr create \ | |
| --title "${ISSUE_TITLE}" \ | |
| --body "Addresses #${ISSUE_NUMBER}\n\nGenerated with Claude Code" \ | |
| --head "$BRANCH_NAME" \ | |
| --base main | |
| # Comment on original issue | |
| gh issue comment ${ISSUE_NUMBER} --body "PR created: $(gh pr view --json url --jq .url)" | |
| fi |