Skip to content

Commit ec5cb79

Browse files
authored
Update github.ts
1 parent b039a4b commit ec5cb79

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

lib/github.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export async function createCommit(
1515
) {
1616
let commitTreeSha = args.tree
1717
if (args.files.length > 0) {
18-
console.log('Creating commit tree...')
18+
console.log('Creating blobs...')
1919
let progress = 0
2020
const commitTreeBlobs = await Promise.all(args.files.map(async ({path, mode, status, loadContent}) => (async function(){
2121
switch (status) {
@@ -53,24 +53,24 @@ export async function createCommit(
5353
})().finally(() => {
5454
progress++;
5555
// log progress
56-
console.log(`${progress} of ${args.files.length} files...`)
56+
console.log(` ${progress} of ${args.files.length} files...`)
5757
})
5858
))
59-
59+
console.log('Creating commit tree...')
6060
const chunkSize = 100
61-
let currentBaseTree = args.parents[0]
61+
6262
for (let i = 0; i < commitTreeBlobs.length; i += chunkSize) {
6363
const chunk = commitTreeBlobs.slice(i, i + chunkSize)
64-
console.log(`Creating commit tree (${i + chunk.length} of ${commitTreeBlobs.length} blob(s))...`)
65-
currentBaseTree = await octokit.rest.git.createTree({
64+
commitTreeSha = await octokit.rest.git.createTree({
6665
...repository,
67-
base_tree: currentBaseTree,
66+
base_tree: commitTreeSha,
6867
tree: chunk,
69-
}).then(({data}) => data.sha)
68+
}).then(({data}) => data.sha).finally(() => {
69+
progress++;
70+
// log progress
71+
console.log(` ${progress} of ${args.files.length} blobs...`)
72+
})
7073
}
71-
commitTreeSha = currentBaseTree
72-
73-
console.log('Creating commit tree done.', commitTreeSha)
7474
}
7575

7676
console.log('Creating commit...')

0 commit comments

Comments
 (0)