From e7667abffb0c8a9a3777db9276d640bfeb8b68ff Mon Sep 17 00:00:00 2001 From: Vincent Le Goff Date: Mon, 28 Jul 2025 15:23:38 +0200 Subject: [PATCH] feat(inputs): add option to disable the post action --- action.yml | 4 ++++ src/git-source-settings.ts | 5 +++++ src/main.ts | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/action.yml b/action.yml index 6842eb843..29399be89 100644 --- a/action.yml +++ b/action.yml @@ -98,6 +98,10 @@ inputs: github-server-url: description: The base URL for the GitHub instance that you are trying to clone from, will use environment defaults to fetch from the same instance that the workflow is running from unless specified. Example URLs are https://github.com or https://my-ghes-server.example.com required: false + skip-cleanup: + description: Skips the cleanup phase on post action hook + required: false + default: false outputs: ref: description: 'The branch, tag or SHA that was checked out' diff --git a/src/git-source-settings.ts b/src/git-source-settings.ts index 4e41ac302..9781a5a19 100644 --- a/src/git-source-settings.ts +++ b/src/git-source-settings.ts @@ -118,4 +118,9 @@ export interface IGitSourceSettings { * User override on the GitHub Server/Host URL that hosts the repository to be cloned */ githubServerUrl: string | undefined + + /** + * Disable the post action cleanup phase + */ + skipCleanup: boolean } diff --git a/src/main.ts b/src/main.ts index 0684c6f5e..24a62fc24 100644 --- a/src/main.ts +++ b/src/main.ts @@ -30,6 +30,12 @@ async function run(): Promise { } async function cleanup(): Promise { + const sourceSettings = await inputHelper.getInputs() + + if (sourceSettings.skipCleanup) { + return + } + try { await gitSourceProvider.cleanup(stateHelper.RepositoryPath) } catch (error) {