-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from Financial-Times/support-dot-in-repo-name
Support a dot in repo names.
- Loading branch information
Showing
2 changed files
with
13 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
const GITHUB_REPO_REGEX = /^(?:\S*github\.com(?:\/|:))?([\w-]+)\/([\w-]+)/; | ||
const GITHUB_REPO_REGEX = /^(?:\S*github\.com(?:\/|:))?([\w-]+)\/([\w-\.]+)/; | ||
|
||
/** | ||
* Array of repo string patterns supported by `extractOwnerAndRepo`. | ||
* | ||
* @type {Array<string>} | ||
*/ | ||
const SUPPORTED_REPO_STRING_PATTERNS = [ | ||
'github-organization/github-repo-name', | ||
'github.com/github-organization/github-repo-name', | ||
'subdomain.github.com/github-organization/github-repo-name', | ||
'https://github.com/github-organization/github-repo-name', | ||
'https://github.com/github-organization/github-repo-name/blob/master', | ||
'https://github.com/github-organization/github-repo-name.git', | ||
'git+https://github.com/github-organization/github-repo-name.git', | ||
'[email protected]:github-organization/github-repo-name.git' | ||
'github-organization/github-repo.name', | ||
'github.com/github-organization/github-repo.name', | ||
'subdomain.github.com/github-organization/github-repo.name', | ||
'https://github.com/github-organization/github-repo.name', | ||
'https://github.com/github-organization/github-repo.name/blob/master', | ||
'https://github.com/github-organization/github-repo.name.git', | ||
'git+https://github.com/github-organization/github-repo.name.git', | ||
'[email protected]:github-organization/github-repo.name.git' | ||
]; | ||
|
||
/** | ||
|
@@ -24,6 +24,9 @@ const SUPPORTED_REPO_STRING_PATTERNS = [ | |
* @returns {object} - Properties: owner, repo | ||
*/ | ||
function extractOwnerAndRepo(githubRepoString) { | ||
// Remove trailing .git extension | ||
githubRepoString = githubRepoString.replace(/.git$/, ''); | ||
// Match owner and repo | ||
const matches = GITHUB_REPO_REGEX.exec(githubRepoString); | ||
|
||
if (matches === null) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters