Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 22 additions & 4 deletions .github/workflows/gemini-after-peers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,37 @@ jobs:
core.setOutput('skip', 'true');
return;
}
if (pr.head.sha !== headSha) {
core.info(`Stale peer gate for ${headSha}; live PR head is ${pr.head.sha}`);
core.setOutput('skip', 'true');
core.setOutput('reason', 'peer gate SHA is stale');
return;
}
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
per_page: 100,
});
const ready = comments
.filter(c => c.body && c.body.includes('<!-- peer-review-ready -->'))
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at))[0];
const stateComment = comments
.filter(c =>
c.body &&
c.body.includes('<!-- agent-peer-response-state:v2 -->') &&
c.body.includes(`head_sha: ${headSha}`)
)
.sort((a, b) => new Date(b.updated_at) - new Date(a.updated_at))[0];
const state = stateComment?.body.match(/^state:\s*(.+)$/m)?.[1]?.trim() || 'missing';
const ready = stateComment?.body.match(/^ready:\s*(.+)$/m)?.[1]?.trim() || 'false';
if (state !== 'responses_collected' || ready !== 'true') {
core.info(`Peer response contract not satisfied: state=${state} ready=${ready}`);
core.setOutput('skip', 'true');
core.setOutput('reason', `peer response contract is ${state}`);
return;
}
core.setOutput('skip', 'false');
core.setOutput('pr_number', String(prNumber));
core.setOutput('head_sha', headSha || '');
core.setOutput('peer_body', (ready?.body || '').slice(0, 1800));
core.setOutput('peer_body', (stateComment?.body || '').slice(0, 1800));

# Trusted composite actions from default branch (workflow_run privilege)
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
Expand Down
Loading
Loading