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
50 changes: 50 additions & 0 deletions .github/workflows/claude-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
pull_request:
types: [opened, ready_for_review, synchronize]
workflow_call: # to allow other workflows to call this workflow
inputs:
hide_previous_comments:
description: 'Hide previous bot review comments before posting new one'
type: boolean
default: false

# Prevent multiple simultaneous reviews on same PR
# If a new commit is pushed while review is running, cancel the old review and start fresh
Expand Down Expand Up @@ -50,6 +55,51 @@ jobs:
aws-iam-role: ${{ secrets.CLAUDE_BEDROCK_IAM_ROLE }}
aws-region: ${{ env.AWS_REGION }}

- name: Hide previous review comments
if: ${{ inputs.hide_previous_comments == true }}
env:
GH_TOKEN: ${{ steps.auth.outputs.github-token }}
run: |
BOT_LOGIN="constructor-claude-bedrock"
echo "Looking for comments from: $BOT_LOGIN"

COMMENTS=$(gh api graphql -f query='
query($owner: String!, $repo: String!, $number: Int!) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $number) {
comments(first: 100) {
nodes {
id
author { login }
isMinimized
}
}
}
}
}
' -f owner='${{ github.repository_owner }}' \
-f repo='${{ github.event.repository.name }}' \
-F number=${{ github.event.pull_request.number }} \
--jq ".data.repository.pullRequest.comments.nodes[] | select(.author.login == \"$BOT_LOGIN\" and .isMinimized == false) | .id")

if [ -z "$COMMENTS" ]; then
echo "No previous comments to hide"
exit 0
fi

for COMMENT_ID in $COMMENTS; do
echo "Minimizing comment: $COMMENT_ID"
gh api graphql -f query='
mutation($id: ID!) {
minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) {
minimizedComment { isMinimized }
}
}
' -f id="$COMMENT_ID" || echo "Warning: Failed to minimize $COMMENT_ID"
done

echo "Finished hiding previous comments"

- name: Run Claude Code Review
id: claude-review
uses: anthropics/claude-code-action@f30f5eecfce2f34fa72e40fa5f7bcdbdcad12eb8 # v1
Expand Down
Loading