Skip to content

fix: specify ref, add timeout and continue-on-error#6

Merged
zfarrell merged 3 commits intomainfrom
fix/checkout-ref-and-resilience
Mar 13, 2026
Merged

fix: specify ref, add timeout and continue-on-error#6
zfarrell merged 3 commits intomainfrom
fix/checkout-ref-and-resilience

Conversation

@zfarrell
Copy link
Contributor

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.

claude[bot]
claude bot previously approved these changes Mar 13, 2026
echo "EOF" >> $GITHUB_OUTPUT

- uses: anthropics/claude-code-action@v1
continue-on-error: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

claude[bot]
claude bot previously approved these changes Mar 13, 2026
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'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Suggested change
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."
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 }}

@zfarrell zfarrell merged commit f61de52 into main Mar 13, 2026
1 check passed
@zfarrell zfarrell deleted the fix/checkout-ref-and-resilience branch March 13, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant