Skip to content

Commit

Permalink
fix: handle custom url without prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdlg committed Dec 17, 2017
1 parent fc6bdc6 commit 2bad805
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/verify.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const url = require('url');
const {isString, isPlainObject, isUndefined, isArray} = require('lodash');
const parseGithubUrl = require('parse-github-url');
const urlJoin = require('url-join');
const SemanticReleaseError = require('@semantic-release/error');
const resolveConfig = require('./resolve-config');
const getClient = require('./get-client');
Expand Down Expand Up @@ -35,7 +35,7 @@ module.exports = async (pluginConfig, {repositoryUrl}, logger) => {
}

if (githubUrl) {
logger.log('Verify Github authentication (%s)', url.resolve(githubUrl, githubApiPathPrefix));
logger.log('Verify Github authentication (%s)', urlJoin(githubUrl, githubApiPathPrefix));
} else {
logger.log('Verify Github authentication');
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"lodash": "^4.17.4",
"mime": "^2.0.3",
"p-reduce": "^1.0.0",
"parse-github-url": "^1.0.1"
"parse-github-url": "^1.0.1",
"url-join": "^2.0.2"
},
"devDependencies": {
"ava": "^0.24.0",
Expand Down
3 changes: 1 addition & 2 deletions test/verify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ test.serial('Verify package, token and repository with environment variables', a
const repo = 'test_repo';
process.env.GH_URL = 'https://othertesturl.com:443';
process.env.GH_TOKEN = 'github_token';
process.env.GH_PREFIX = 'prefix';

const github = authenticate({
githubUrl: process.env.GH_URL,
Expand All @@ -94,7 +93,7 @@ test.serial('Verify package, token and repository with environment variables', a
)
);
t.true(github.isDone());
t.deepEqual(t.context.log.args[0], ['Verify Github authentication (%s)', 'https://othertesturl.com:443/prefix']);
t.deepEqual(t.context.log.args[0], ['Verify Github authentication (%s)', 'https://othertesturl.com:443/']);
});

test.serial('Verify package, token and repository access with alternative environment varialbes', async t => {
Expand Down

0 comments on commit 2bad805

Please sign in to comment.