Skip to content

Add support for more repository address formats #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 20, 2025
Merged

Add support for more repository address formats #7

merged 4 commits into from
Jun 20, 2025

Conversation

mcafaro
Copy link
Member

@mcafaro mcafaro commented Jun 20, 2025

This change adds support for SSH and git protocol repository address formats.

With this change, we can now parse:

SSH and git protocol (ssh branch):

Shorthand and domain/owner/repo:

  • owner/repo (shorthand, assumes github.com)
  • github.com/owner/repo

HTTP(S) URLs:

  • https://github.com/owner/repo
  • https://github.com/enterprises/enterprise/owner/repo (GitHub Enterprise)

Closes #5

@mcafaro mcafaro requested a review from davidbuzinski June 20, 2025 15:51
Comment on lines 38 to 44
if (parts.length === 2 && parts[0].includes(".")) {
// host/owner (missing repo)
return {
origin: `https://${parts[0]}`,
owner: parts[1],
repo: parts[2], // will be undefined, so will be caught below
};
Copy link

@davidbuzinski davidbuzinski Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic looks correct, but I think the comment is off. This looks like the github.com/owner/repo case

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nevermind. I see it's parts.length === 2. I am a little confused about parsing and returning for this case. This is to handle false positive matches where they left off the repo? If we don't include this, we'll accidentally match?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed. AI snuck it past me.

@mcafaro mcafaro merged commit 367c1c4 into main Jun 20, 2025
1 check passed
@mcafaro mcafaro deleted the ssh branch June 20, 2025 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow the generator to accept different types of URLs (ssh, partial etc..)
2 participants