Merge pull request #7188 from continuedev/tomasz/fix-gh-action-condition

Tomasz/fix gh action condition
This commit is contained in:
Tomasz Stefaniak 2025-08-18 11:24:23 -07:00 • committed by GitHub
commit 216f4568b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 57 additions and 27 deletions

View file

@ -18,7 +18,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Run Detailed PR Review
uses: continuedev/continue/actions/detailed-review@23d9260536372acf4eb57a41e6ab62bc5869b070
uses: continuedev/continue/actions/detailed-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe
with:
continue-api-key: ${{ secrets.CONTINUE_API_KEY }}
continue-org: continuedev

View file

@ -18,7 +18,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Run Continue PR Review Action
uses: continuedev/continue/actions/general-review@23d9260536372acf4eb57a41e6ab62bc5869b070
uses: continuedev/continue/actions/general-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe
with:
continue-api-key: ${{ secrets.CONTINUE_API_KEY }}
continue-org: "continuedev"

View file

@ -219,7 +219,7 @@ We recommend using a specific commit SHA for stability and predictability:
Example:
```yaml
uses: continuedev/continue/actions/general-review@17fe39cc4f1760838ce4428aad0a984af13f8266
uses: continuedev/continue/actions/general-review@64bda6b2b3dac1037e9895dbee4ce1d35565e1fe
```
## Troubleshooting

View file

@ -29,12 +29,17 @@ runs:
SHOULD_RUN="false"
if [ "${{ github.event_name }}" = "pull_request" ]; then
# Check PR author association
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
SHOULD_RUN="true"
# Check if PR is a draft
if [ "${{ github.event.pull_request.draft }}" = "true" ]; then
echo "::notice::Skipping review - PR is a draft"
else
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
# Check PR author association
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
SHOULD_RUN="true"
else
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
fi
fi
elif [ "${{ github.event_name }}" = "issue_comment" ]; then
# Check if it's a PR comment with the trigger phrase
@ -268,7 +273,23 @@ runs:
console.log('Invalid comments:', JSON.stringify(invalidComments, null, 2));
}
const comments = validComments.map(comment => ({
// Deduplicate comments based on path + position + body
const uniqueComments = [];
const seen = new Set();
for (const comment of validComments) {
const key = `${comment.path}:${comment.position}:${comment.body}`;
if (!seen.has(key)) {
seen.add(key);
uniqueComments.push(comment);
}
}
if (uniqueComments.length < validComments.length) {
console.log(`Filtered out ${validComments.length - uniqueComments.length} duplicate comments (same path + position + body)`);
}
const comments = uniqueComments.map(comment => ({
path: comment.path,
position: comment.position,
body: comment.body
@ -283,12 +304,19 @@ runs:
// Create the review
if (comments.length > 0) {
try {
let reviewBody = `${reviewData.review_summary || 'AI Code Review'}\n\n---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`;
// Add triggered by note if from comment
if (context.eventName === 'issue_comment') {
reviewBody = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${reviewBody}`;
}
await github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
commit_id: commitSha,
body: `${reviewData.review_summary || 'AI Code Review'}\n\n---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`,
body: reviewBody,
event: 'COMMENT',
comments: comments
});
@ -310,22 +338,19 @@ runs:
}
} else {
// No inline comments, just post the summary
let summaryBody = `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*\n\n` +
`---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`;
// Add triggered by note if from comment
if (context.eventName === 'issue_comment') {
summaryBody = `*Triggered by @${context.payload.comment.user.login}'s request*\n\n${summaryBody}`;
}
await github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: `## AI Code Review\n\n${reviewData.review_summary}\n\n*No specific line comments generated.*\n\n` +
`---\n*💡 To request a new detailed review, comment \`@continue-detailed-review\`*`
});
}
// Add triggered by note if from comment
if (context.eventName === 'issue_comment') {
await github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: `*Inline review triggered by @${context.payload.comment.user.login}*`
body: summaryBody
});
}

View file

@ -29,12 +29,17 @@ runs:
SHOULD_RUN="false"
if [ "${{ github.event_name }}" = "pull_request" ]; then
# Check PR author association
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
SHOULD_RUN="true"
# Check if PR is a draft
if [ "${{ github.event.pull_request.draft }}" = "true" ]; then
echo "::notice::Skipping review - PR is a draft"
else
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
# Check PR author association
AUTHOR_ASSOC="${{ github.event.pull_request.author_association }}"
if [ "$AUTHOR_ASSOC" = "OWNER" ] || [ "$AUTHOR_ASSOC" = "MEMBER" ] || [ "$AUTHOR_ASSOC" = "COLLABORATOR" ]; then
SHOULD_RUN="true"
else
echo "::notice::Skipping review - PR author is not a team member (association: $AUTHOR_ASSOC)"
fi
fi
elif [ "${{ github.event_name }}" = "issue_comment" ]; then
# Check if it's a PR comment with the trigger phrase