fix: add logging for when ssh falls back to http (#1639)
Co-authored-by: thomas williams <thomas.williams@thetradedesk.com>
This commit is contained in:
		
							parent
							
								
									c982249f87
								
							
						
					
					
						commit
						b4c5d0a436
					
				| @ -2,6 +2,7 @@ const {parse, format} = require('url'); // eslint-disable-line node/no-deprecate | ||||
| const {isNil} = require('lodash'); | ||||
| const hostedGitInfo = require('hosted-git-info'); | ||||
| const {verifyAuth} = require('./git'); | ||||
| const debug = require('debug')('semantic-release:get-git-auth-url'); | ||||
| 
 | ||||
| /** | ||||
|  * Determine the the git repository URL to use to push, either: | ||||
| @ -42,8 +43,11 @@ module.exports = async ({cwd, env, branch, options: {repositoryUrl}}) => { | ||||
| 
 | ||||
|   // Test if push is allowed without transforming the URL (e.g. is ssh keys are set up)
 | ||||
|   try { | ||||
|     debug('Verifying ssh auth by attempting to push to  %s', repositoryUrl); | ||||
|     await verifyAuth(repositoryUrl, branch.name, {cwd, env}); | ||||
|   } catch (_) { | ||||
|     debug('SSH key auth failed, falling back to https.'); | ||||
| 
 | ||||
|     const envVar = Object.keys(GIT_TOKENS).find((envVar) => !isNil(env[envVar])); | ||||
|     const gitCredentials = `${GIT_TOKENS[envVar] || ''}${env[envVar] || ''}`; | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user