1
1
const isBase64 = require ( "is-base64" ) ;
2
- module . exports = function ( octokit , opts ) {
2
+ module . exports = function ( octokit , opts ) {
3
3
return new Promise ( async ( resolve , reject ) => {
4
4
// Up front validation
5
5
try {
@@ -31,7 +31,7 @@ module.exports = function(octokit, opts) {
31
31
committer,
32
32
author,
33
33
changes,
34
- batchSize
34
+ batchSize,
35
35
} = opts ;
36
36
37
37
let branchAlreadyExists = true ;
@@ -55,7 +55,7 @@ module.exports = function(octokit, opts) {
55
55
base = (
56
56
await octokit . rest . repos . get ( {
57
57
owner,
58
- repo
58
+ repo,
59
59
} )
60
60
) . data . default_branch ;
61
61
}
@@ -92,7 +92,7 @@ module.exports = function(octokit, opts) {
92
92
if ( hasFilesToDelete ) {
93
93
for ( const batch of chunk ( change . filesToDelete , batchSize ) ) {
94
94
await Promise . all (
95
- batch . map ( async fileName => {
95
+ batch . map ( async ( fileName ) => {
96
96
const exists = await fileExistsInRepo (
97
97
octokit ,
98
98
owner ,
@@ -115,7 +115,7 @@ module.exports = function(octokit, opts) {
115
115
path : fileName ,
116
116
sha : null , // sha as null implies that the file should be deleted
117
117
mode : "100644" ,
118
- type : "commit"
118
+ type : "commit" ,
119
119
} ) ;
120
120
}
121
121
} )
@@ -125,7 +125,7 @@ module.exports = function(octokit, opts) {
125
125
126
126
for ( const batch of chunk ( Object . keys ( change . files ) , batchSize ) ) {
127
127
await Promise . all (
128
- batch . map ( async fileName => {
128
+ batch . map ( async ( fileName ) => {
129
129
const properties = change . files [ fileName ] || "" ;
130
130
131
131
const contents = properties . contents || properties ;
@@ -148,7 +148,7 @@ module.exports = function(octokit, opts) {
148
148
path : fileName ,
149
149
sha : fileSha ,
150
150
mode : mode ,
151
- type : type
151
+ type : type ,
152
152
} ) ;
153
153
} )
154
154
) ;
@@ -200,7 +200,7 @@ module.exports = function(octokit, opts) {
200
200
repo,
201
201
force : true ,
202
202
ref : `${ updateRefBase } heads/${ branchName } ` ,
203
- sha : baseTree
203
+ sha : baseTree ,
204
204
} ) ;
205
205
206
206
// Return the new branch name so that we can use it later
@@ -219,7 +219,7 @@ async function fileExistsInRepo(octokit, owner, repo, path, branch) {
219
219
owner,
220
220
repo,
221
221
path,
222
- ref : branch
222
+ ref : branch ,
223
223
} ) ;
224
224
return true ;
225
225
} catch ( e ) {
@@ -245,7 +245,7 @@ async function createCommit(
245
245
committer,
246
246
author,
247
247
tree : tree . sha ,
248
- parents : [ baseTree ]
248
+ parents : [ baseTree ] ,
249
249
} )
250
250
) . data ;
251
251
}
@@ -256,7 +256,7 @@ async function createTree(octokit, owner, repo, treeItems, baseTree) {
256
256
owner,
257
257
repo,
258
258
tree : treeItems ,
259
- base_tree : baseTree
259
+ base_tree : baseTree ,
260
260
} )
261
261
) . data ;
262
262
}
@@ -276,7 +276,7 @@ async function createBlob(octokit, owner, repo, contents, type) {
276
276
owner,
277
277
repo,
278
278
content,
279
- encoding : "base64"
279
+ encoding : "base64" ,
280
280
} )
281
281
) . data ;
282
282
return file . sha ;
@@ -288,7 +288,7 @@ async function loadRef(octokit, owner, repo, ref) {
288
288
const x = await octokit . rest . git . getRef ( {
289
289
owner,
290
290
repo,
291
- ref : `heads/${ ref } `
291
+ ref : `heads/${ ref } ` ,
292
292
} ) ;
293
293
return x . data . object . sha ;
294
294
} catch ( e ) {
0 commit comments