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
51 changes: 46 additions & 5 deletions .github/workflows/engine-review-pass.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@ on:
types: [opened, synchronize, reopened]
pull_request_review:
types: [submitted, dismissed]
issue_comment:
types: [created, edited]
Comment thread
PetrefiedThunder marked this conversation as resolved.
Resolved
Comment thread
PetrefiedThunder marked this conversation as resolved.
Resolved
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Comment thread
PetrefiedThunder marked this conversation as resolved.
Resolved

# Review bursts must not cancel in-progress runs.
concurrency:
group: engine-review-pass-${{ github.event.pull_request.number }}
group: engine-review-pass-${{ github.event.pull_request.number || github.event.issue.number }}
cancel-in-progress: false

permissions:
statuses: write
pull-requests: read
issues: read
contents: read

jobs:
Expand All @@ -30,7 +33,20 @@ jobs:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const pr = context.payload.pull_request;
let pr = context.payload.pull_request;

if (!pr) {
if (!context.payload.issue?.pull_request) {
core.info('Issue comment is not on a pull request. Skipping.');
return;
}
const prResponse = await github.rest.pulls.get({
owner,
repo,
pull_number: context.payload.issue.number,
});
pr = prResponse.data;
}

if (!pr) {
core.setFailed('Could not determine pull request from event payload.');
Expand All @@ -50,6 +66,9 @@ jobs:
'grok',
'muse',
'kimi',
'pi',
'deepseek',
'hermes',
Comment thread
PetrefiedThunder marked this conversation as resolved.
Resolved
'visual-designer',
'product-designer',
]);
Expand Down Expand Up @@ -107,7 +126,29 @@ jobs:

core.info(`Total reviews retrieved: ${reviews.length}`);

const eligibleReviews = reviews.filter((r) => {
core.info(`Fetching comments for pull request #${prNumber}...`);

const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number: prNumber,
per_page: 100,
});

core.info(`Total issue comments retrieved: ${comments.length}`);

const normalizedComments = comments.map((c) => ({
id: c.id,
body: c.body,
submitted_at: c.created_at,
Comment thread
PetrefiedThunder marked this conversation as resolved.
Resolved
Comment thread
PetrefiedThunder marked this conversation as resolved.
Resolved
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
author_association: c.author_association,
user: c.user,
state: 'COMMENTED',
}));

const allReviews = reviews.concat(normalizedComments);

const eligibleReviews = allReviews.filter((r) => {
if (r.state === 'DISMISSED' || !r.submitted_at || !r.body) {
return false;
}
Expand All @@ -131,7 +172,7 @@ jobs:
});

// The marker must be alone on its own line.
const markerRegex = /^REVIEW: (PASS|BLOCKED|FAIL) ([A-Za-z0-9._-]+) ([0-9a-f]{7,40})\s*$/;
const markerRegex = /^REVIEW: (PASS|BLOCKED|FAIL) ([A-Za-z0-9._-]+) ([0-9a-f]{40})\s*$/;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
Comment thread
PetrefiedThunder marked this conversation as resolved.
Resolved
const headShaLower = headSha.toLowerCase();
const authorEngineLower = authorEngine.toLowerCase();

Expand All @@ -154,7 +195,7 @@ jobs:
continue;
}

if (!headShaLower.startsWith(markerSha.toLowerCase())) {
if (markerSha.toLowerCase() !== headShaLower) {
core.info(`Ignoring marker for non-matching SHA ${markerSha} on head ${headSha}`);
continue;
}
Expand Down
Loading