Skip to content

Commit 8d19e7d

Browse files
Copilotqoomon
andauthored
build: update dist/index.js
Agent-Logs-Url: https://github.com/qoomon/actions--create-commit/sessions/fcd62384-c129-41e6-8e6f-8513fe000308 Co-authored-by: qoomon <3963394+qoomon@users.noreply.github.com>
1 parent ec5cb79 commit 8d19e7d

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

dist/index.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38203,7 +38203,7 @@ async function getCachedObjectSha(path) {
3820338203
async function createCommit(octokit, repository, args) {
3820438204
let commitTreeSha = args.tree;
3820538205
if (args.files.length > 0) {
38206-
console.log('Creating commit tree...');
38206+
console.log('Creating blobs...');
3820738207
let progress = 0;
3820838208
const commitTreeBlobs = await Promise.all(args.files.map(async ({ path, mode, status, loadContent }) => (async function () {
3820938209
switch (status) {
@@ -38240,21 +38240,22 @@ async function createCommit(octokit, repository, args) {
3824038240
})().finally(() => {
3824138241
progress++;
3824238242
// log progress
38243-
console.log(`${progress} of ${args.files.length} files...`);
38243+
console.log(` ${progress} of ${args.files.length} files...`);
3824438244
})));
38245+
console.log('Creating commit tree...');
3824538246
const chunkSize = 100;
38246-
let currentBaseTree = args.parents[0];
3824738247
for (let i = 0; i < commitTreeBlobs.length; i += chunkSize) {
3824838248
const chunk = commitTreeBlobs.slice(i, i + chunkSize);
38249-
console.log(`Creating commit tree (${i + chunk.length} of ${commitTreeBlobs.length})...`);
38250-
currentBaseTree = await octokit.rest.git.createTree({
38249+
commitTreeSha = await octokit.rest.git.createTree({
3825138250
...repository,
38252-
base_tree: currentBaseTree,
38251+
base_tree: commitTreeSha,
3825338252
tree: chunk,
38254-
}).then(({ data }) => data.sha);
38253+
}).then(({ data }) => data.sha).finally(() => {
38254+
progress++;
38255+
// log progress
38256+
console.log(` ${progress} of ${args.files.length} blobs...`);
38257+
});
3825538258
}
38256-
commitTreeSha = currentBaseTree;
38257-
console.log('Creating commit tree done.', commitTreeSha);
3825838259
}
3825938260
console.log('Creating commit...');
3826038261
const commit = await octokit.rest.git.createCommit({

0 commit comments

Comments
 (0)