fix: prefix git auth url with "x-access-token:" when run in a GitHub Action

This commit is contained in:
Scott Willeke
2019-09-12 12:30:03 -07:00
committed by Gregor Martynus
parent 3e4bb40990
commit cb2c506d8b
2 changed files with 25 additions and 10 deletions
+13
View File
@@ -273,6 +273,19 @@ test('Return the "https" formatted URL if "gitCredentials" is defined with "BITB
);
});
test('Return the "https" formatted URL if "GITHUB_ACTION" is set', async t => {
const {cwd} = await gitRepo();
t.is(
await getAuthUrl({
cwd,
env: {...env, GITHUB_ACTION: 'foo', GITHUB_TOKEN: 'token'},
options: {branch: 'master', repositoryUrl: 'git@host.null:owner/repo.git'},
}),
'https://x-access-token:token@host.null/owner/repo.git'
);
});
test('Handle "https" URL with group and subgroup, with "GIT_CREDENTIALS"', async t => {
const {cwd} = await gitRepo();