2022-10-03 20:04:49 +03:00
import * as core from '@actions/core'
2019-12-12 21:16:16 +03:00
/ * *
* Indicates whether the POST action is running
* /
2022-10-03 20:04:49 +03:00
export const IsPost = ! ! core . getState ( 'isPost' )
2019-12-12 21:16:16 +03:00
/ * *
* The repository path for the POST action . The value is empty during the MAIN action .
* /
2022-10-03 20:04:49 +03:00
export const RepositoryPath = core . getState ( 'repositoryPath' )
2019-12-12 21:16:16 +03:00
2022-04-21 04:37:43 +03:00
/ * *
* The set - safe - directory for the POST action . The value is set if input : 'safe-directory' is set during the MAIN action .
* /
2022-10-03 20:04:49 +03:00
export const PostSetSafeDirectory = core . getState ( 'setSafeDirectory' ) === 'true'
2022-04-21 04:37:43 +03:00
2020-03-11 22:55:17 +03:00
/ * *
* The SSH key path for the POST action . The value is empty during the MAIN action .
* /
2022-10-03 20:04:49 +03:00
export const SshKeyPath = core . getState ( 'sshKeyPath' )
2020-03-11 22:55:17 +03:00
/ * *
* The SSH known hosts path for the POST action . The value is empty during the MAIN action .
* /
2022-10-03 20:04:49 +03:00
export const SshKnownHostsPath = core . getState ( 'sshKnownHostsPath' )
2020-03-11 22:55:17 +03:00
2019-12-12 21:16:16 +03:00
/ * *
* Save the repository path so the POST action can retrieve the value .
* /
export function setRepositoryPath ( repositoryPath : string ) {
2022-10-03 20:04:49 +03:00
core . saveState ( 'repositoryPath' , repositoryPath )
2019-12-12 21:16:16 +03:00
}
2020-03-11 22:55:17 +03:00
/ * *
* Save the SSH key path so the POST action can retrieve the value .
* /
export function setSshKeyPath ( sshKeyPath : string ) {
2022-10-03 20:04:49 +03:00
core . saveState ( 'sshKeyPath' , sshKeyPath )
2020-03-11 22:55:17 +03:00
}
/ * *
* Save the SSH known hosts path so the POST action can retrieve the value .
* /
export function setSshKnownHostsPath ( sshKnownHostsPath : string ) {
2022-10-03 20:04:49 +03:00
core . saveState ( 'sshKnownHostsPath' , sshKnownHostsPath )
2020-03-11 22:55:17 +03:00
}
2022-04-21 04:37:43 +03:00
/ * *
2022-12-29 01:19:08 +03:00
* Save the set - safe - directory input so the POST action can retrieve the value .
2022-04-21 04:37:43 +03:00
* /
export function setSafeDirectory() {
2022-10-03 20:04:49 +03:00
core . saveState ( 'setSafeDirectory' , 'true' )
2022-04-21 04:37:43 +03:00
}
2019-12-12 21:16:16 +03:00
// 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 ) {
2022-10-03 20:04:49 +03:00
core . saveState ( 'isPost' , 'true' )
2019-12-12 21:16:16 +03:00
}