11const isBase64 = require ( "is-base64" ) ;
2- module . exports = function ( octokit , opts ) {
2+ module . exports = function ( octokit , opts ) {
33 return new Promise ( async ( resolve , reject ) => {
44 // Up front validation
55 try {
@@ -31,7 +31,7 @@ module.exports = function(octokit, opts) {
3131 committer,
3232 author,
3333 changes,
34- batchSize
34+ batchSize,
3535 } = opts ;
3636
3737 let branchAlreadyExists = true ;
@@ -55,7 +55,7 @@ module.exports = function(octokit, opts) {
5555 base = (
5656 await octokit . rest . repos . get ( {
5757 owner,
58- repo
58+ repo,
5959 } )
6060 ) . data . default_branch ;
6161 }
@@ -92,7 +92,7 @@ module.exports = function(octokit, opts) {
9292 if ( hasFilesToDelete ) {
9393 for ( const batch of chunk ( change . filesToDelete , batchSize ) ) {
9494 await Promise . all (
95- batch . map ( async fileName => {
95+ batch . map ( async ( fileName ) => {
9696 const exists = await fileExistsInRepo (
9797 octokit ,
9898 owner ,
@@ -115,7 +115,7 @@ module.exports = function(octokit, opts) {
115115 path : fileName ,
116116 sha : null , // sha as null implies that the file should be deleted
117117 mode : "100644" ,
118- type : "commit"
118+ type : "commit" ,
119119 } ) ;
120120 }
121121 } )
@@ -125,7 +125,7 @@ module.exports = function(octokit, opts) {
125125
126126 for ( const batch of chunk ( Object . keys ( change . files ) , batchSize ) ) {
127127 await Promise . all (
128- batch . map ( async fileName => {
128+ batch . map ( async ( fileName ) => {
129129 const properties = change . files [ fileName ] || "" ;
130130
131131 const contents = properties . contents || properties ;
@@ -148,7 +148,7 @@ module.exports = function(octokit, opts) {
148148 path : fileName ,
149149 sha : fileSha ,
150150 mode : mode ,
151- type : type
151+ type : type ,
152152 } ) ;
153153 } )
154154 ) ;
@@ -200,7 +200,7 @@ module.exports = function(octokit, opts) {
200200 repo,
201201 force : true ,
202202 ref : `${ updateRefBase } heads/${ branchName } ` ,
203- sha : baseTree
203+ sha : baseTree ,
204204 } ) ;
205205
206206 // Return the new branch name so that we can use it later
@@ -219,7 +219,7 @@ async function fileExistsInRepo(octokit, owner, repo, path, branch) {
219219 owner,
220220 repo,
221221 path,
222- ref : branch
222+ ref : branch ,
223223 } ) ;
224224 return true ;
225225 } catch ( e ) {
@@ -245,7 +245,7 @@ async function createCommit(
245245 committer,
246246 author,
247247 tree : tree . sha ,
248- parents : [ baseTree ]
248+ parents : [ baseTree ] ,
249249 } )
250250 ) . data ;
251251}
@@ -256,7 +256,7 @@ async function createTree(octokit, owner, repo, treeItems, baseTree) {
256256 owner,
257257 repo,
258258 tree : treeItems ,
259- base_tree : baseTree
259+ base_tree : baseTree ,
260260 } )
261261 ) . data ;
262262}
@@ -276,7 +276,7 @@ async function createBlob(octokit, owner, repo, contents, type) {
276276 owner,
277277 repo,
278278 content,
279- encoding : "base64"
279+ encoding : "base64" ,
280280 } )
281281 ) . data ;
282282 return file . sha ;
@@ -288,7 +288,7 @@ async function loadRef(octokit, owner, repo, ref) {
288288 const x = await octokit . rest . git . getRef ( {
289289 owner,
290290 repo,
291- ref : `heads/${ ref } `
291+ ref : `heads/${ ref } ` ,
292292 } ) ;
293293 return x . data . object . sha ;
294294 } catch ( e ) {
0 commit comments