1
0
Fork 0
mirror of https://code.forgejo.org/actions/checkout.git synced 2025-04-27 14:29:54 +02:00

add ssh support (#163)

This commit is contained in:
eric sciple 2020-03-11 15:55:17 -04:00 committed by GitHub
parent 80602fafba
commit b2e6b7ed13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 837 additions and 58 deletions

View file

@ -11,6 +11,17 @@ export const IsPost = !!process.env['STATE_isPost']
export const RepositoryPath =
(process.env['STATE_repositoryPath'] as string) || ''
/**
* The SSH key path for the POST action. The value is empty during the MAIN action.
*/
export const SshKeyPath = (process.env['STATE_sshKeyPath'] as string) || ''
/**
* The SSH known hosts path for the POST action. The value is empty during the MAIN action.
*/
export const SshKnownHostsPath =
(process.env['STATE_sshKnownHostsPath'] as string) || ''
/**
* Save the repository path so the POST action can retrieve the value.
*/
@ -22,6 +33,24 @@ export function setRepositoryPath(repositoryPath: string) {
)
}
/**
* Save the SSH key path so the POST action can retrieve the value.
*/
export function setSshKeyPath(sshKeyPath: string) {
coreCommand.issueCommand('save-state', {name: 'sshKeyPath'}, sshKeyPath)
}
/**
* Save the SSH known hosts path so the POST action can retrieve the value.
*/
export function setSshKnownHostsPath(sshKnownHostsPath: string) {
coreCommand.issueCommand(
'save-state',
{name: 'sshKnownHostsPath'},
sshKnownHostsPath
)
}
// 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) {