File tree Expand file tree Collapse file tree 2 files changed +37
-6
lines changed Expand file tree Collapse file tree 2 files changed +37
-6
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,22 @@ module.exports = async function ({
2828
2929 source . branch = target ;
3030
31- await octokit . repos . updateInformationAboutPagesSite ( {
32- owner,
33- repo,
34- source,
35- } ) ;
31+ if ( ! dryRun ) {
32+ await octokit . repos . updateInformationAboutPagesSite ( {
33+ owner,
34+ repo,
35+ source,
36+ } ) ;
37+ }
3638
3739 log (
3840 `Updated GitHub pages from [${ old } ] to [${ target } ] with path [${ source . path } ]`
3941 ) ;
4042 } catch ( e ) {
41- log ( `No GitHub Pages found for [${ owner } /${ repo } ]` ) ;
43+ if ( e . status === 404 ) {
44+ log ( `No GitHub Pages found for [${ owner } /${ repo } ]` ) ;
45+ return ;
46+ }
47+ throw e ;
4248 }
4349} ;
Original file line number Diff line number Diff line change @@ -83,6 +83,31 @@ describe("#github-pages", () => {
8383 ) ;
8484 } ) ;
8585
86+ it ( "respects dryRun" , async ( ) => {
87+ nock ( "https://api.github.com/" )
88+ . get ( "/repos/demo/repo/pages" )
89+ . reply ( 200 , {
90+ source : {
91+ branch : "master" ,
92+ path : "/" ,
93+ } ,
94+ } ) ;
95+
96+ await githubPages ( {
97+ owner : "demo" ,
98+ repo : "repo" ,
99+ old : "master" ,
100+ target : "main" ,
101+ octokit,
102+ log,
103+ dryRun : true ,
104+ } ) ;
105+
106+ expect ( log . logger ) . toBeCalledWith (
107+ "Updated GitHub pages from [master] to [main] with path [/]"
108+ ) ;
109+ } ) ;
110+
86111 it ( "configures actions with the new branch (custom path)" , async ( ) => {
87112 nock ( "https://api.github.com/" )
88113 . get ( "/repos/demo/repo/pages" )
You can’t perform that action at this time.
0 commit comments