test: integration test fixes

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

View file

@ -83,8 +83,6 @@ export class GitConfigHelper {
'^(https?)://(?:.+@)?(.+?)/(.+/.+?)(\\.git)?$',
'i'
)
const sshUrlPattern = new RegExp('^git@(.+?):(.+/.+)\\.git$', 'i')
const httpsMatch = remoteUrl.match(httpsUrlPattern)
if (httpsMatch) {
return {
@ -94,6 +92,7 @@ export class GitConfigHelper {
}
}
const sshUrlPattern = new RegExp('^git@(.+?):(.+/.+)\\.git$', 'i')
const sshMatch = remoteUrl.match(sshUrlPattern)
if (sshMatch) {
return {
@ -103,6 +102,17 @@ export class GitConfigHelper {
}
}
// 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`
)