diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2a9e6b2..a4bc22f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,5 @@ on: push: - pull_request: workflow_dispatch: schedule: - cron: '0 12 18 * *' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0878271..a9a740c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,6 +56,7 @@ jobs: paths_ignore: '["**/*.md"]' cancel_others: 'true' do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]' + concurrent_skipping: 'true' - if: ${{ steps.skip_check.outputs.should_skip == 'false' }} run: | echo "Do stuff..." && sleep 30 diff --git a/README.md b/README.md index 2a33918..f0437d1 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,10 @@ If true, then workflow-runs from outdated commits will be cancelled. Default `tr A JSON-array with triggers that should never be skipped. Default `'["workflow_dispatch", "schedule"]'`. +### `concurrent_skipping` + +If false, unfinished workflow-runs will be safely ignored. Default `true`. + ## Outputs ### `should_skip` diff --git a/action.yml b/action.yml index 19f7843..7ccffc5 100644 --- a/action.yml +++ b/action.yml @@ -24,6 +24,10 @@ inputs: description: 'A JSON-array with triggers that should never be skipped' required: false default: '["workflow_dispatch", "schedule"]' + concurrent_skipping: + description: 'If false, unfinished workflow-runs will be safely ignored' + required: false + default: 'true' outputs: should_skip: diff --git a/dist/index.js b/dist/index.js index e1a9af6..f5ae49e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -9955,6 +9955,7 @@ async function main() { pathsIgnore: getStringArrayInput("paths_ignore"), paths: getStringArrayInput("paths"), doNotSkip: getStringArrayInput("do_not_skip"), + concurrentSkipping: getBooleanInput("concurrent_skipping", true), }; } catch (e) { @@ -10028,12 +10029,15 @@ function detectDuplicateRuns(context) { } return true; }); - if (concurrentDuplicate) { + if (concurrentDuplicate && context.concurrentSkipping) { core.info(`Skip execution because the exact same files are concurrently checked in ${concurrentDuplicate.html_url}`); exitSuccess({ shouldSkip: true }); } } function detectExplicitConcurrentTrigger(context) { + if (!context.concurrentSkipping) { + return; + } const duplicateTriggerRun = context.allRuns.find((run) => { if (run.treeHash !== context.currentRun.treeHash) { return false; diff --git a/src/index.ts b/src/index.ts index f26755d..d7e81a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -35,6 +35,7 @@ interface WRunContext { pathsIgnore: string[]; paths: string[]; doNotSkip: WRunTrigger[]; + concurrentSkipping: boolean; } function parseWorkflowRun(run: ActionsGetWorkflowRunResponseData): WorkflowRun { @@ -117,6 +118,7 @@ async function main() { pathsIgnore: getStringArrayInput("paths_ignore"), paths: getStringArrayInput("paths"), doNotSkip: getStringArrayInput("do_not_skip") as WRunTrigger[], + concurrentSkipping: getBooleanInput("concurrent_skipping", true), }; } catch (e) { core.warning(e); @@ -193,13 +195,16 @@ function detectDuplicateRuns(context: WRunContext) { } return true; }); - if (concurrentDuplicate) { + if (concurrentDuplicate && context.concurrentSkipping) { core.info(`Skip execution because the exact same files are concurrently checked in ${concurrentDuplicate.html_url}`); exitSuccess({ shouldSkip: true }); } } function detectExplicitConcurrentTrigger(context: WRunContext) { + if (!context.concurrentSkipping) { + return; + } const duplicateTriggerRun = context.allRuns.find((run) => { if (run.treeHash !== context.currentRun.treeHash) { return false;