Skip to content

feat(inputs): add option to disable the post action #2228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 5 additions & 0 deletions src/git-source-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ async function run(): Promise<void> {
}

async function cleanup(): Promise<void> {
const sourceSettings = await inputHelper.getInputs()

if (sourceSettings.skipCleanup) {
return
}

try {
await gitSourceProvider.cleanup(stateHelper.RepositoryPath)
} catch (error) {
Expand Down