fix: do not transform repositoryUrl if it allow to push
Even the user set Git credentials via environment variable, use the configured URL (with authentication) if it works. This allow users to push tags and commits via ssh while still using the GitHub/GitLab API.
This commit is contained in:
+4
-2
@@ -3,7 +3,7 @@ const readPkgUp = require('read-pkg-up');
|
||||
const cosmiconfig = require('cosmiconfig');
|
||||
const resolveFrom = require('resolve-from');
|
||||
const debug = require('debug')('semantic-release:config');
|
||||
const {repoUrl} = require('./git');
|
||||
const {repoUrl, verifyAuth} = require('./git');
|
||||
const PLUGINS_DEFINITIONS = require('./definitions/plugins');
|
||||
const plugins = require('./plugins');
|
||||
const getGitAuthUrl = require('./get-git-auth-url');
|
||||
@@ -51,7 +51,9 @@ module.exports = async (opts, logger) => {
|
||||
...pickBy(options, option => !isUndefined(option) && !isNull(option)),
|
||||
};
|
||||
|
||||
options.repositoryUrl = options.repositoryUrl ? getGitAuthUrl(options.repositoryUrl) : options.repositoryUrl;
|
||||
if (!await verifyAuth(options.repositoryUrl, options.branch)) {
|
||||
options.repositoryUrl = options.repositoryUrl ? getGitAuthUrl(options.repositoryUrl) : options.repositoryUrl;
|
||||
}
|
||||
|
||||
debug('options values: %O', options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user