diff --git a/src/cli/commands/test/iac/meta.ts b/src/cli/commands/test/iac/meta.ts index 80b5f77ec63..a86a45a389e 100644 --- a/src/cli/commands/test/iac/meta.ts +++ b/src/cli/commands/test/iac/meta.ts @@ -78,6 +78,7 @@ export function getProjectNameFromGitUrl(url: string) { /^ssh:\/\/([^@]+@)?[^:/]+(:[^/]+)?\/(?.*).git\/?$/, /^(git|https?|ftp):\/\/[^:/]+(:[^/]+)?\/(?.*).git\/?$/, /^[^@]+@[^:]+:(?.*).git$/, + /^(https?):\/\/github.com\/(?.*)$/, ]; const trimmed = url.trim(); diff --git a/test/jest/unit/cli/commands/test/iac/meta.spec.ts b/test/jest/unit/cli/commands/test/iac/meta.spec.ts index 994ccc1f8db..67532081999 100644 --- a/test/jest/unit/cli/commands/test/iac/meta.spec.ts +++ b/test/jest/unit/cli/commands/test/iac/meta.spec.ts @@ -230,6 +230,11 @@ describe('getProjectNameFromGitUrl', () => { 'git@github.com:user/repo.git', + // Remote URLs set up by 'actions/checkout' in GitHub workflows. + + 'https://github.com/user/repo', + 'http://github.com/user/repo', + // If everything else fails, the URL should be returned as-is, but trimmed. 'user/repo',