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