File tree 2 files changed +15
-8
lines changed
2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -5885,12 +5885,14 @@ async function main() {
5885
5885
workflow_id,
5886
5886
branch,
5887
5887
} ) ;
5888
- console . log ( `Found ${ data . total_count } runs total.` ) ;
5889
- const runningWorkflows = data . workflow_runs . filter ( run => run . head_branch === branch &&
5890
- ( ignore_sha || run . head_sha !== headSha ) &&
5888
+ const branchWorkflows = data . workflow_runs . filter ( run => run . head_branch === branch ) ;
5889
+ console . log ( `Found ${ branchWorkflows . length } runs total for branch ${ branch } .` ) ;
5890
+ console . log ( branchWorkflows . map ( run => `- ${ run . html_url } ` ) . join ( '\n' ) ) ;
5891
+ const runningWorkflows = branchWorkflows . filter ( run => ( ignore_sha || run . head_sha !== headSha ) &&
5891
5892
run . status !== 'completed' &&
5892
5893
new Date ( run . created_at ) < new Date ( current_run . created_at ) ) ;
5893
- console . log ( `Found ${ runningWorkflows . length } runs in progress.` ) ;
5894
+ console . log ( `Found ${ runningWorkflows . length } runs to cancel.` ) ;
5895
+ console . log ( runningWorkflows . map ( run => `- ${ run . html_url } ` ) . join ( '\n' ) ) ;
5894
5896
for ( const { id, head_sha, status } of runningWorkflows ) {
5895
5897
console . log ( 'Cancelling another run: ' , { id, head_sha, status } ) ;
5896
5898
const res = await octokit . actions . cancelWorkflowRun ( {
Original file line number Diff line number Diff line change @@ -55,14 +55,19 @@ async function main() {
55
55
workflow_id,
56
56
branch,
57
57
} ) ;
58
- console . log ( `Found ${ data . total_count } runs total.` ) ;
59
- const runningWorkflows = data . workflow_runs . filter ( run =>
60
- run . head_branch === branch &&
58
+
59
+ const branchWorkflows = data . workflow_runs . filter ( run => run . head_branch === branch ) ;
60
+ console . log ( `Found ${ branchWorkflows . length } runs total for branch ${ branch } .` ) ;
61
+ console . log ( branchWorkflows . map ( run => `- ${ run . html_url } ` ) . join ( '\n' ) ) ;
62
+
63
+ const runningWorkflows = branchWorkflows . filter ( run =>
61
64
( ignore_sha || run . head_sha !== headSha ) &&
62
65
run . status !== 'completed' &&
63
66
new Date ( run . created_at ) < new Date ( current_run . created_at )
64
67
) ;
65
- console . log ( `Found ${ runningWorkflows . length } runs in progress.` ) ;
68
+ console . log ( `Found ${ runningWorkflows . length } runs to cancel.` ) ;
69
+ console . log ( runningWorkflows . map ( run => `- ${ run . html_url } ` ) . join ( '\n' ) ) ;
70
+
66
71
for ( const { id, head_sha, status} of runningWorkflows ) {
67
72
console . log ( 'Cancelling another run: ' , { id, head_sha, status} ) ;
68
73
const res = await octokit . actions . cancelWorkflowRun ( {
You can’t perform that action at this time.
0 commit comments