fix: specify ref, add timeout and continue-on-error#6
Conversation
| echo "EOF" >> $GITHUB_OUTPUT | ||
|
|
||
| - uses: anthropics/claude-code-action@v1 | ||
| continue-on-error: true |
There was a problem hiding this comment.
With continue-on-error: true, failures in the Claude step are silently swallowed — an expired API key or persistent outage would stop reviews from happening with no signal to the team. Consider adding a follow-up step that posts a PR comment when this step fails:
- if: failure()
run: gh pr comment ${{ github.event.pull_request.number }} --body "⚠️ Automated review unavailable (Claude step failed). Please review manually."
env:
GH_TOKEN: ${{ github.token }}Non-blocking suggestion — the resilience intent is sound.
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
| --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr review:*),Read" | ||
|
|
||
| - name: Notify on review failure | ||
| if: steps.review.outcome == 'failure' || steps.review.outcome == 'cancelled' |
There was a problem hiding this comment.
The steps.review.outcome == 'cancelled' check is unreachable as written. When a job is cancelled, subsequent steps only run if the if: condition includes always(). Without it, this step is skipped entirely when the workflow is cancelled.
To actually catch the cancellation case:
| if: steps.review.outcome == 'failure' || steps.review.outcome == 'cancelled' | |
| if: always() && (steps.review.outcome == 'failure' || steps.review.outcome == 'cancelled') |
|
|
||
| - name: Notify on review failure | ||
| if: steps.review.outcome == 'failure' || steps.review.outcome == 'cancelled' | ||
| run: gh pr comment ${{ github.event.pull_request.number }} --body "Automated review unavailable (Claude step failed). Please review manually." |
There was a problem hiding this comment.
Minor: prefer passing the PR number via an env var rather than interpolating it inline into the shell command. pull_request.number is always an integer so there's no real injection risk here, but it's cleaner and consistent with GHA best practices.
| run: gh pr comment ${{ github.event.pull_request.number }} --body "Automated review unavailable (Claude step failed). Please review manually." | |
| run: gh pr comment "$PR_NUMBER" --body "Automated review unavailable (Claude step failed). Please review manually." |
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.pull_request.number }}
Adds ref: main to cross-repo checkout to skip default branch lookup, 15min timeout, and continue-on-error on the claude step so API failures don't block PRs.