Skip to content

Commit 2bad805

Browse files
committed
fix: handle custom url without prefix
1 parent fc6bdc6 commit 2bad805

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

lib/verify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
const url = require('url');
21
const {isString, isPlainObject, isUndefined, isArray} = require('lodash');
32
const parseGithubUrl = require('parse-github-url');
3+
const urlJoin = require('url-join');
44
const SemanticReleaseError = require('@semantic-release/error');
55
const resolveConfig = require('./resolve-config');
66
const getClient = require('./get-client');
@@ -35,7 +35,7 @@ module.exports = async (pluginConfig, {repositoryUrl}, logger) => {
3535
}
3636

3737
if (githubUrl) {
38-
logger.log('Verify Github authentication (%s)', url.resolve(githubUrl, githubApiPathPrefix));
38+
logger.log('Verify Github authentication (%s)', urlJoin(githubUrl, githubApiPathPrefix));
3939
} else {
4040
logger.log('Verify Github authentication');
4141
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"lodash": "^4.17.4",
2525
"mime": "^2.0.3",
2626
"p-reduce": "^1.0.0",
27-
"parse-github-url": "^1.0.1"
27+
"parse-github-url": "^1.0.1",
28+
"url-join": "^2.0.2"
2829
},
2930
"devDependencies": {
3031
"ava": "^0.24.0",

test/verify.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ test.serial('Verify package, token and repository with environment variables', a
7676
const repo = 'test_repo';
7777
process.env.GH_URL = 'https://othertesturl.com:443';
7878
process.env.GH_TOKEN = 'github_token';
79-
process.env.GH_PREFIX = 'prefix';
8079

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

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

0 commit comments

Comments
 (0)