Skip to content

Commit 50a1b0d

Browse files
authored
Merge pull request #43 from stilliard/claude/add-merge-queue-support-2RBx2
Add merge queue support for task-list-completed checks
2 parents 18b23a2 + 810821a commit 50a1b0d

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

app.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ default_events:
2323
# - fork
2424
# - gollum
2525
- issue_comment
26+
- merge_group
2627
# - issues
2728
# - label
2829
# - milestone

index.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,36 @@ const ENABLE_ID_LOGS = true; // Repo name & ID only for logs, no private data lo
55
module.exports = (app) => {
66
app.log('Yay! The app was loaded!');
77

8+
// handle merge queue events - a PR can only enter the merge queue after all
9+
// required checks (including task-list-completed) have already passed, so we
10+
// can immediately report success here to unblock the queue.
11+
app.on('merge_group.checks_requested', async context => {
12+
const headSha = context.payload.merge_group.head_sha;
13+
const prRepo = context.payload.repository.full_name;
14+
15+
context.log.info(`PR ${prRepo}: Merge queue check requested for ${headSha}, reporting success`);
16+
17+
const check = {
18+
name: 'task-list-completed',
19+
head_sha: headSha,
20+
status: 'completed',
21+
conclusion: 'success',
22+
started_at: (new Date).toISOString(),
23+
completed_at: (new Date).toISOString(),
24+
output: {
25+
title: 'All tasks already verified',
26+
summary: 'Tasks were already checked before this PR entered the merge queue',
27+
},
28+
};
29+
30+
try {
31+
const response = await context.octokit.checks.create(context.repo(check));
32+
context.log.info(`PR ${prRepo}: Merge queue check response status ${response.status}`);
33+
} catch (err) {
34+
context.log.error(`PR ${prRepo}: Error sending merge queue check. Error (${err.status}): ${err.message}`);
35+
}
36+
});
37+
838
// watch for pull requests & their changes
939
app.on([
1040
'pull_request.opened',

0 commit comments

Comments
 (0)