mirror of
https://gitea.com/actions/checkout.git
synced 2025-04-06 23:39:40 +00:00
Add SSH user parameter (#1685)
* Add a configurable SSH user * Update docs with param * Indentation of readme * formatting woes * Update src/url-helper.ts Co-authored-by: Josh Gross <joshmgross@github.com> * Update action.yml Co-authored-by: Josh Gross <joshmgross@github.com> * Update genfiles --------- Co-authored-by: Josh Gross <joshmgross@github.com>
This commit is contained in:
4
dist/index.js
vendored
4
dist/index.js
vendored
@ -1798,6 +1798,7 @@ function getInputs() {
|
||||
result.sshKnownHosts = core.getInput('ssh-known-hosts');
|
||||
result.sshStrict =
|
||||
(core.getInput('ssh-strict') || 'true').toUpperCase() === 'TRUE';
|
||||
result.sshUser = core.getInput('ssh-user');
|
||||
// Persist credentials
|
||||
result.persistCredentials =
|
||||
(core.getInput('persist-credentials') || 'false').toUpperCase() === 'TRUE';
|
||||
@ -2400,7 +2401,8 @@ function getFetchUrl(settings) {
|
||||
const encodedOwner = encodeURIComponent(settings.repositoryOwner);
|
||||
const encodedName = encodeURIComponent(settings.repositoryName);
|
||||
if (settings.sshKey) {
|
||||
return `git@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
|
||||
const user = settings.sshUser.length > 0 ? settings.sshUser : 'git';
|
||||
return `${user}@${serviceUrl.hostname}:${encodedOwner}/${encodedName}.git`;
|
||||
}
|
||||
// "origin" is SCHEME://HOSTNAME[:PORT]
|
||||
return `${serviceUrl.origin}/${encodedOwner}/${encodedName}`;
|
||||
|
Reference in New Issue
Block a user