diff options
| author | eric sciple <ericsciple@users.noreply.github.com> | 2019-12-12 13:16:16 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-12-12 13:16:16 -0500 |
| commit | 25ac60e43ded675f082e10f444b0ad95ea43622e (patch) | |
| tree | 4f254bf120e072e899f70c2646541eeec6fbbd63 /src/state-helper.ts | |
| parent | f60b14d6faba41537d0983497a96349d75b1b481 (diff) | |
fallback to REST API to download repo (#104)
Diffstat (limited to 'src/state-helper.ts')
| -rw-r--r-- | src/state-helper.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/state-helper.ts b/src/state-helper.ts new file mode 100644 index 0000000..0f86a14 --- /dev/null +++ b/src/state-helper.ts @@ -0,0 +1,30 @@ +import * as core from '@actions/core' +import * as coreCommand from '@actions/core/lib/command' + +/** + * Indicates whether the POST action is running + */ +export const IsPost = !!process.env['STATE_isPost'] + +/** + * The repository path for the POST action. The value is empty during the MAIN action. + */ +export const RepositoryPath = + (process.env['STATE_repositoryPath'] as string) || '' + +/** + * Save the repository path so the POST action can retrieve the value. + */ +export function setRepositoryPath(repositoryPath: string) { + coreCommand.issueCommand( + 'save-state', + {name: 'repositoryPath'}, + repositoryPath + ) +} + +// 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) { + coreCommand.issueCommand('save-state', {name: 'isPost'}, 'true') +} |
