-
-
Notifications
You must be signed in to change notification settings - Fork 434
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
Strip optional '.git' suffix from https server remote name. #1153
Strip optional '.git' suffix from https server remote name. #1153
Conversation
Hi @salexander6 Thank you for identifying this issue. I'm interested to know how this occurs so I can reproduce it. Please could you show me a workflow that results in this happening. Perhaps you are not using the official |
src/utils.ts
Outdated
@@ -46,12 +46,14 @@ export function getRemoteDetail(remoteUrl: string): RemoteDetail { | |||
throw new Error('Could not parse GitHub Server name') | |||
} | |||
|
|||
remoteUrl = remoteUrl.replace(/\.git$/, '') | |||
|
|||
const httpsUrlPattern = new RegExp( | |||
'^https?://.*@?' + githubServerMatch[1] + '/(.+/.+)$', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to fix this by only changing the regex.
'^https?://.*@?' + githubServerMatch[1] + '/(.+/.+?)(.git)?$',
Also, please add a test for this pattern here:
https://github.com/peter-evans/create-pull-request/blob/main/__test__/utils.unit.test.ts#L35-L53
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to fix this by only changing the regex.
👍
The repo is private but here's the relevant workflow section
Adding this here has me wondering if cloning without the |
This reverts commit c2e9041.
Ok, it makes sense now. Not using the official checkout action causes the remote URL to include the |
/test repository=99spokes/create-pull-request ref=fix-https-repository-name build=true |
Thank you! Released as |
Thanks for the great action! |
…er-evans#1153) * Strip optional '.git' suffix from https server remote name. * Revert "Strip optional '.git' suffix from https server remote name." This reverts commit c2e9041. * Strip optional '.git' suffix from https server remote name.
Fixes an error when creating a PR, similar to what is described here #1096
My repository name was identified as
data.git
and the.git
suffix caused an error when creating the PR here https://github.com/peter-evans/create-pull-request/blob/main/src/github-helper.ts#L47