File tree 2 files changed +37
-6
lines changed
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 ({
28
28
29
29
source . branch = target ;
30
30
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
+ }
36
38
37
39
log (
38
40
`Updated GitHub pages from [${ old } ] to [${ target } ] with path [${ source . path } ]`
39
41
) ;
40
42
} 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 ;
42
48
}
43
49
} ;
Original file line number Diff line number Diff line change @@ -83,6 +83,31 @@ describe("#github-pages", () => {
83
83
) ;
84
84
} ) ;
85
85
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
+
86
111
it ( "configures actions with the new branch (custom path)" , async ( ) => {
87
112
nock ( "https://api.github.com/" )
88
113
. get ( "/repos/demo/repo/pages" )
You can’t perform that action at this time.
0 commit comments