Support any format of repository URL
Tho I am able to push & pull from public git repo, when I run semantic-release-cli setup, I'm asked the following question
Is the GitHub repository private?
When I say N, It is immediately exiting the prompt with the above error.
The github repo I'm accessing is under an organization called 1tontech & I'm a member of it. (I own the Org aswell)
semantic-release-cli --version returns 3.0.3
Is there a way for me to get the log?
Hi @thekalinga have you tried with capital "N"? it seems the promp only allows regular "y" or capital "N".
Let me know so we can close down the issue.
@lespinalrivera I just hit this issue, and tried the default (no input), lowercase n, and capital N. All gave the same error:
? Is the GitHub repository private? No
ERR! semantic-release Error: Could not access GitHub repository
ERR! semantic-release at /Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:98:13
ERR! semantic-release at Generator.next (<anonymous>)
ERR! semantic-release at step (/Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:27:191)
ERR! semantic-release at /Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:27:361
ERR! semantic-release { Error: Could not access GitHub repository
ERR! semantic-release at /Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:98:13
ERR! semantic-release at Generator.next (<anonymous>)
ERR! semantic-release at step (/Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:27:191)
ERR! semantic-release at /Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:27:361
ERR! semantic-release stack: 'Error: Could not access GitHub repository\n at /Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:98:13\n at Generator.next (<anonymous>)\n at step (/Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:27:191)\n at /Users/jasonlengstorf/.nvm/versions/node/v7.10.0/lib/node_modules/semantic-release-cli/dist/lib/repository.js:27:361' }
For anyone coming across this in the future, the problem was the repository field in my package.json. I switched the URL format to follow this pattern:
"repository": {
"type": "git",
"url": "https://github.com/gramps-graphql/gramps-express.git"
},
And the error cleared up.
@jlengstorf this is a case we might want to handle. Could you let us know what was your repository setting before ?
@pvdlg I'm seeing this again on a repo with the following config:
"repository": {
"type": "git",
"url": "[email protected]:gramps-graphql/data-source-base.git"
},
Updating to:
"repository": {
"type": "git",
"url": "https://github.com/gramps-graphql/data-source-base.git"
},
Fixed the problem.
I'm not sure if I custom-configured that and screwed something up, but it could be helpful to add a check that outputs a helpful error message along the lines of:
ERR! semantic-release Error: Could not access GitHub repository. Please check that the
`repository.url` setting in `package.json` uses the following format:
https://github.com/user_or_org/repo_name.git
I could potentially add that PR — let me know if the above solution is acceptable.
@jlengstorf thanks for the info!
We need the repository url in semantic-release to make API call to Github.
I wonder if there is a good way to determine that the API URL that correspond to [email protected]:gramps-graphql/data-source-base.git is https://github.com/user_or_org/repo_name.git.
@pvdlg If we were to use something like parse-repo, it would probably be relatively painless to implement.
Without a new dependency, it might be a bit trickier, but would ultimately just be pattern matching for (https://|git@)github.com(:|/)$1/$2.git, then building the URL we want from the matches.
parse-repo seems a good solution. @gr2m what do you think?
I just tested this in my console. May not need the new dependency if this is the only requirement.
const gitRegex = new RegExp('(?:git@|https://)github.com(?:/|:)(\w+)/(\w+).git');
const urls = [
'[email protected]:username/reponame.git',
'https://github.com/username/reponame.git',
];
const parsed = urls.map(str => str.replace(gitRegex, 'https://github.com/$1/$2.git'));
EDIT: changed the regex declaration to make it a little easier to read.
parse-repo seems a good solution. @gr2m what do you think?
sounds good to me! I’d prefer to use https://www.npmjs.com/package/parse-repo instead of maintaining our on regex
sounds good to me! I’d prefer to use https://www.npmjs.com/package/parse-repo instead of maintaining our on regex
Me too, that the greatness of npm and its ecosystem.
We would also need to implement that in the main semantic-release I think.
if you know the places that where we need to fix that, can you create issues on the CLI and semantic-release repo with all context information needed to fix it? It’d be a good issue to onboard new contributors,maybe @jlengstorf wants to give it a go? Once we have the other issues, we can close this one
Happy to take a crack at the PR. I’ll watch for the issues that replace this one. On Wed, Oct 18, 2017 at 15:55 Gregor Martynus [email protected] wrote:
if you know the places that where we need to fix that, can you create issues on the CLI and semantic-release repo with all context information needed to fix it? It’d be a good issue to onboard new contributors,maybe @jlengstorf https://github.com/jlengstorf wants to give it a go? Once we have the other issues, we can close this one
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/semantic-release/cli/issues/105#issuecomment-337724985, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJ-6aH7_9hxt0JNeZyL9Crzj6VfXrCBks5stmWjgaJpZM4LxZj1 .
-- Jason Lengstorf Get #deepinthecreep: Facebook | Twitter | Instagram Oversharing at lengstorf.com