Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/claude-pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
# TODO: remove author filter after testing is complete
if: github.event.pull_request.draft == false && github.event.pull_request.user.login == 'zfarrell'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
pull-requests: write
Expand All @@ -29,6 +30,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: hotdata-dev/github-workflows
ref: main
token: ${{ steps.app-token.outputs.token }}
path: .github-workflows
sparse-checkout: docs/claude-pr-review-prompt.md
Expand All @@ -43,6 +45,8 @@ jobs:
echo "EOF" >> $GITHUB_OUTPUT

- uses: anthropics/claude-code-action@v1
id: review
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.

with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
track_progress: false
Expand All @@ -53,3 +57,9 @@ jobs:
${{ steps.prompt.outputs.content }}
claude_args: |
--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')

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

env:
GH_TOKEN: ${{ github.token }}
Loading