From 5b226525b332718d26fabcfbd1830cdc32336398 Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Wed, 20 Apr 2022 21:37:43 -0400 Subject: Add set-safe-directory input to allow customers to take control. (#770) * Add set-safe-directory input to allow customers to take control. --- src/state-helper.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/state-helper.ts') diff --git a/src/state-helper.ts b/src/state-helper.ts index 3c657b1..2db79f9 100644 --- a/src/state-helper.ts +++ b/src/state-helper.ts @@ -11,6 +11,12 @@ export const IsPost = !!process.env['STATE_isPost'] export const RepositoryPath = (process.env['STATE_repositoryPath'] as string) || '' +/** + * The set-safe-directory for the POST action. The value is set if input: 'safe-directory' is set during the MAIN action. + */ +export const PostSetSafeDirectory = + (process.env['STATE_setSafeDirectory'] as string) === 'true' + /** * The SSH key path for the POST action. The value is empty during the MAIN action. */ @@ -51,6 +57,13 @@ export function setSshKnownHostsPath(sshKnownHostsPath: string) { ) } +/** + * Save the sef-safe-directory input so the POST action can retrieve the value. + */ +export function setSafeDirectory() { + coreCommand.issueCommand('save-state', {name: 'setSafeDirectory'}, 'true') +} + // Publish a variable so that when the POST action runs, it can determine it should run the cleanup logic. // This is necessary since we don't have a separate entry point. if (!IsPost) { -- cgit v1.2.3