File tree Expand file tree Collapse file tree 2 files changed +32
-24
lines changed
github-actions/branch-manager Expand file tree Collapse file tree 2 files changed +32
-24
lines changed Original file line number Diff line number Diff line change @@ -16,27 +16,29 @@ async function run() {
1616 return ;
1717 }
1818
19- if ( ref !== 'refs/heads/main' ) {
20- // TODO: support pushes to all releasable branches rather than just main.
21- core . info ( 'Skipping evaluation as the push does not affect the main branch' ) ;
22- return ;
23- }
24-
2519 core . info ( `Evaluating pull requests as a result of a push to '${ ref } '` ) ;
2620
27- const mergeReadyPrQuery =
28- `repo:${ context . repo . owner } /${ context . repo . repo } ` +
29- `is:pr ` +
30- `is:open ` +
31- `label:"${ actionLabels . ACTION_MERGE . name } "` ;
32-
3321 const prs = await github ( ) . then ( ( api ) =>
3422 api . paginate (
35- api . search . issuesAndPullRequests ,
23+ api . pulls . list ,
3624 {
37- q : mergeReadyPrQuery ,
25+ repo : context . repo . repo ,
26+ owner : context . repo . owner ,
27+ state : 'open' ,
28+ per_page : 100 ,
29+ } ,
30+ ( pulls ) => {
31+ return pulls . data
32+ . filter ( ( { labels, base} ) => {
33+ return (
34+ // Whether the pull request is slated to merge into the same branch as the triggering push.
35+ base . ref === ref &&
36+ // Whether the pull request has the action: merge label.
37+ labels . some ( ( { name} ) => name === actionLabels . ACTION_MERGE . name )
38+ ) ;
39+ } )
40+ . map ( ( { number} ) => `${ number } ` ) ;
3841 } ,
39- ( issues ) => issues . data . map ( ( i ) => `${ i . number } ` ) ,
4042 ) ,
4143 ) ;
4244 core . info ( `Triggering ${ prs . length } prs to be evaluated` ) ;
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments