This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/airflow-cancel-workflow-runs.git
commit beb7c0e54fcf533a777cc94eaadbcc9dffe31e6b Author: Jason T. Greene <[email protected]> AuthorDate: Tue Feb 18 22:54:26 2020 -0600 Also filteer non pr and push events --- dist/index.js | 3 ++- src/main.ts | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index ac890d9..08cf9c8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1546,7 +1546,8 @@ function cancelDuplicates(token, selfRunId, owner, repo, workflowId, branch, eve matched = true; core.info(`Matched ${selfRunId}`); } - if ('completed' === element.status.toString()) { + if ('completed' === element.status.toString() || + !['push', 'pull_request'].includes(element.event.toString)) { continue; } // This is a set of one in the non-schedule case, otherwise everything is a candidate diff --git a/src/main.ts b/src/main.ts index 560f836..2321b22 100644 --- a/src/main.ts +++ b/src/main.ts @@ -109,7 +109,10 @@ async function cancelDuplicates( core.info(`Matched ${selfRunId}`) } - if ('completed' === element.status.toString()) { + if ( + 'completed' === element.status.toString() || + !['push', 'pull_request'].includes(element.event.toString) + ) { continue }
