Skip to content

Commit

Permalink
fix: Correctly parse the remote URLs set by actions/checkokut
Browse files Browse the repository at this point in the history
  • Loading branch information
francescomari committed Jan 12, 2023
1 parent 8a1b362 commit 5c38a02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cli/commands/test/iac/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export function getProjectNameFromGitUrl(url: string) {
/^ssh:\/\/([^@]+@)?[^:/]+(:[^/]+)?\/(?<name>.*).git\/?$/,
/^(git|https?|ftp):\/\/[^:/]+(:[^/]+)?\/(?<name>.*).git\/?$/,
/^[^@]+@[^:]+:(?<name>.*).git$/,
/^(https?):\/\/github.com\/(?<name>.*)$/,
];

const trimmed = url.trim();
Expand Down
5 changes: 5 additions & 0 deletions test/jest/unit/cli/commands/test/iac/meta.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 5c38a02

Please sign in to comment.