@@ -393,3 +393,38 @@ test.serial('Throw error without retries for 400 error', async (t) => {
393
393
t . is ( error . status , 400 ) ;
394
394
t . true ( github . isDone ( ) ) ;
395
395
} ) ;
396
+
397
+ test . serial . only ( 'Publish a release when env.GITHUB_URL is set to https://github.com (Default in GitHub Actions, #268)' , async ( t ) => {
398
+ const owner = 'test_user' ;
399
+ const repo = 'test_repo' ;
400
+ const env = { GITHUB_TOKEN : 'github_token' , GITHUB_URL : 'https://github.com' , GITHUB_API_URL : 'https://api.github.com' } ;
401
+ const pluginConfig = { } ;
402
+ const nextRelease = { gitTag : 'v1.0.0' , name : 'v1.0.0' , notes : 'Test release note body' } ;
403
+ const options = { repositoryUrl : `https://github.com/${ owner } /${ repo } .git` } ;
404
+ const releaseUrl = `https://github.com/${ owner } /${ repo } /releases/${ nextRelease . version } ` ;
405
+ const releaseId = 1 ;
406
+ const uploadUri = `/api/uploads/repos/${ owner } /${ repo } /releases/${ releaseId } /assets` ;
407
+ const uploadUrl = `https://github.com${ uploadUri } {?name,label}` ;
408
+
409
+ const github = authenticate ( { ...env , GITHUB_TOKEN : 'https://api.github.com' } )
410
+ . post ( `/repos/${ owner } /${ repo } /releases` , {
411
+ tag_name : nextRelease . gitTag ,
412
+ name : nextRelease . name ,
413
+ body : nextRelease . notes ,
414
+ prerelease : false ,
415
+ } )
416
+ . reply ( 200 , { upload_url : uploadUrl , html_url : releaseUrl } ) ;
417
+
418
+ const result = await publish ( pluginConfig , {
419
+ cwd,
420
+ env,
421
+ options,
422
+ branch : { type : 'release' , main : true } ,
423
+ nextRelease,
424
+ logger : t . context . logger ,
425
+ } ) ;
426
+
427
+ t . is ( result . url , releaseUrl ) ;
428
+ t . deepEqual ( t . context . log . args [ 0 ] , [ 'Published GitHub release: %s' , releaseUrl ] ) ;
429
+ t . true ( github . isDone ( ) ) ;
430
+ } ) ;
0 commit comments