File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ default_events:
2323# - fork
2424# - gollum
2525 - issue_comment
26+ - merge_group
2627# - issues
2728# - label
2829# - milestone
Original file line number Diff line number Diff line change @@ -5,6 +5,36 @@ const ENABLE_ID_LOGS = true; // Repo name & ID only for logs, no private data lo
55module . 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' ,
You can’t perform that action at this time.
0 commit comments