test: integration test fixes

This commit is contained in:
Peter Evans 2023-12-19 11:29:19 +00:00
parent d2781bf605
commit e879d98c57
6 changed files with 76 additions and 30 deletions

12
dist/index.js vendored
View file

@ -929,7 +929,6 @@ class GitConfigHelper {
}
static parseGitRemote(remoteUrl) {
const httpsUrlPattern = new RegExp('^(https?)://(?:.+@)?(.+?)/(.+/.+?)(\\.git)?$', 'i');
const sshUrlPattern = new RegExp('^git@(.+?):(.+/.+)\\.git$', 'i');
const httpsMatch = remoteUrl.match(httpsUrlPattern);
if (httpsMatch) {
return {
@ -938,6 +937,7 @@ class GitConfigHelper {
repository: httpsMatch[3]
};
}
const sshUrlPattern = new RegExp('^git@(.+?):(.+/.+)\\.git$', 'i');
const sshMatch = remoteUrl.match(sshUrlPattern);
if (sshMatch) {
return {
@ -946,6 +946,16 @@ class GitConfigHelper {
repository: sshMatch[2]
};
}
// Unauthenticated git protocol for integration tests only
const gitUrlPattern = new RegExp('^git://(.+?)/(.+/.+)\\.git$', 'i');
const gitMatch = remoteUrl.match(gitUrlPattern);
if (gitMatch) {
return {
hostname: gitMatch[1],
protocol: 'GIT',
repository: gitMatch[2]
};
}
throw new Error(`The format of '${remoteUrl}' is not a valid GitHub repository URL`);
}
savePersistedAuth() {