Skip to content

Commit

Permalink
fix(verify): call GitHub API only if url is valid
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed May 11, 2018
1 parent 12c152b commit 3c97850
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ module.exports = async (pluginConfig, {options: {repositoryUrl}, logger}) => {
const {name: repo, owner} = parseGithubUrl(repositoryUrl);
if (!owner || !repo) {
errors.push(getError('EINVALIDGITHUBURL'));
}

if (githubToken) {
} else if (githubToken) {
const github = getClient({githubToken, githubUrl, githubApiPathPrefix});

try {
Expand All @@ -94,9 +92,12 @@ module.exports = async (pluginConfig, {options: {repositoryUrl}, logger}) => {
throw err;
}
}
} else {
}

if (!githubToken) {
errors.push(getError('ENOGHTOKEN', {owner, repo}));
}

if (errors.length > 0) {
throw new AggregateError(errors);
}
Expand Down

0 comments on commit 3c97850

Please sign in to comment.