@@ -7,21 +7,22 @@ const getRepoId = require('./get-repo-id');
77module . exports = async ( pluginConfig , { repositoryUrl} , { gitHead, gitTag, notes} , logger ) => {
88 const { gitlabToken, gitlabUrl, gitlabApiPathPrefix} = resolveConfig ( pluginConfig ) ;
99 const repoId = encodeURIComponent ( getRepoId ( gitlabUrl , repositoryUrl ) ) ;
10+ const apiUrl = urlJoin ( gitlabUrl , gitlabApiPathPrefix ) ;
1011
1112 debug ( 'repoId: %o' , repoId ) ;
1213 debug ( 'release name: %o' , gitTag ) ;
1314 debug ( 'release ref: %o' , gitHead ) ;
1415
1516 try {
1617 // Test if the tag already exists
17- await got . get ( urlJoin ( gitlabUrl , gitlabApiPathPrefix , `/projects/${ repoId } /repository/tags/${ gitTag } ` ) , {
18+ await got . get ( urlJoin ( apiUrl , `/projects/${ repoId } /repository/tags/${ gitTag } ` ) , {
1819 json : true ,
1920 headers : { 'Private-Token' : gitlabToken } ,
2021 } ) ;
2122 debug ( 'The git tag %o already exists, update the release description' , gitTag ) ;
2223 // Update the release notes
2324 await got . post (
24- urlJoin ( gitlabUrl , gitlabApiPathPrefix , `/projects/${ repoId } /repository/tags/${ gitTag } /release` ) ,
25+ urlJoin ( apiUrl , `/projects/${ repoId } /repository/tags/${ gitTag } /release` ) ,
2526 { json : true , headers : { 'Private-Token' : gitlabToken } , body : { tag_name : gitTag , description : notes } } // eslint-disable-line camelcase
2627 ) ;
2728 } catch ( err ) {
@@ -30,7 +31,7 @@ module.exports = async (pluginConfig, {repositoryUrl}, {gitHead, gitTag, notes},
3031 throw err ;
3132 }
3233 debug ( 'Create git tag %o with commit %o and release description' , gitTag , gitHead ) ;
33- await got . post ( urlJoin ( gitlabUrl , gitlabApiPathPrefix , `/projects/${ repoId } /repository/tags/${ gitTag } /release` ) , {
34+ await got . post ( urlJoin ( apiUrl , `/projects/${ repoId } /repository/tags/${ gitTag } /release` ) , {
3435 json : true ,
3536 headers : { 'PRIVATE-TOKEN' : gitlabToken } ,
3637 body : { tag_name : gitTag , ref : gitHead , release_description : notes } , // eslint-disable-line camelcase
0 commit comments