diff --git a/action.yml b/action.yml index 6842eb8..29399be 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 4e41ac3..9781a5a 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 0684c6f..24a62fc 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) {