File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,20 @@ const getCommit = gh => async data => {
33 let commitData = null
44 const options = {
55 user : data . repo . namespace ,
6- repo : data . repo . name ,
7- base : data . build . before ,
8- head : data . build . after
6+ repo : data . repo . name
97 }
10- const comparison = await promisify ( gh . repos . compareCommits ) ( options )
8+
9+ let action = 'compareCommits'
10+ // github sends this in some instances: first commit on a new branch?
11+ if ( ! data . build . before || data . build . before === '0000000000000000000000000000000000000000' ) {
12+ options . sha = data . build . after
13+ action = 'getCommit'
14+ } else {
15+ options . base = data . build . before
16+ options . head = data . build . after
17+ }
18+
19+ const comparison = await promisify ( gh . repos [ action ] ) ( options )
1120 return comparison . files . map ( f => f . filename )
1221}
1322
You can’t perform that action at this time.
0 commit comments