Skip to content
Open
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
30 changes: 30 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ on:
description: >
How the review output should be posted:
- check: post as a check run (requires checks: write permission)
- check_neutral: like check, but uses GitHub's non-blocking `neutral`
conclusion when issues are found, so the check does not shadow
real CI checks in the PR status rollup
- comment: post as a PR comment
- auto: check if allowed, otherwise post as a comment
default: auto
Expand Down Expand Up @@ -171,3 +174,30 @@ jobs:
ANTHROPIC_VERTEX_PROJECT_ID: ${{ secrets.ANTHROPIC_VERTEX_PROJECT_ID }}
CLOUD_ML_REGION: ${{ secrets.CLOUD_ML_REGION }}
PUBLISH_MODE: ${{ inputs.summary-mode }}

# Finalize the "Claude Code Review" check when the review job did not
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI (and probably not the point of this PR) : ideally, I would have called the script from here, instead of letting claude do it. This however required finding how to generate an "outcome" from Claude, and process it in next step, which I did not have to investigate....

(start of review could be posted here instead of in the skill)

# complete normally (action failure, runner timeout, cancellation).
# Without this the check sits at status=in_progress forever and blocks
# any branch protection that waits on it. PATCHes via gh api directly
# so the step has no coupling to the skill's helper script and is a
# natural no-op when no in-progress check exists (e.g. legacy skill).
- name: Finalize stuck Claude Code Review check
if: always() && steps.claude-review.outcome != 'success'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should not be called when using legacy skill (from the repo) which does not rely on the script...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added steps.claude-review.outcome != 'success' so it only applies when required

env:
OWNER_REPO: ${{ github.repository }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
check_id=$(gh api "repos/${OWNER_REPO}/commits/${HEAD_SHA}/check-runs" \
-f check_name="Claude Code Review" \
--jq '.check_runs[] | select(.status != "completed") | .id' | head -1)
if [[ -z "${check_id}" ]]; then
echo "No in-progress 'Claude Code Review' check on this SHA — nothing to finalize"
exit 0
fi
summary="Claude review job did not complete (action failure, timeout, or cancellation). See [workflow logs](${RUN_URL})."
jq -n --arg summary "${summary}" '{
status: "completed",
conclusion: "cancelled",
output: { title: "Claude Code Review: cancelled", summary: $summary }
}' | gh api "repos/${OWNER_REPO}/check-runs/${check_id}" --method PATCH --input -
Loading