From ac0057ab67e7c89895e7955a1df3348f54299924 Mon Sep 17 00:00:00 2001 From: dearfl Date: Thu, 30 Oct 2025 13:14:58 +0800 Subject: [PATCH] push only once per sync --- dist/index.js | 21 +++++++++++++-------- src/action.js | 20 ++++++++++++-------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/dist/index.js b/dist/index.js index 67efc33a..e745d1e5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -14702,14 +14702,6 @@ async function commit(params) { }, }); - await octokit.git.updateRef({ - owner: owner, - repo: repo, - sha: commitResponse.data.sha, - ref: "heads/" + defaultBranch, - force: true, - }); - log(`Committed solution for ${name}`); return [treeResponse.data.sha, commitResponse.data.sha]; @@ -14951,7 +14943,20 @@ async function sync(inputs) { commitHeader, questionData, }); + + if (i != 0) { + continue; + } + + await octokit.git.updateRef({ + owner: owner, + repo: repo, + sha: latestCommitSHA, + ref: "heads/" + defaultBranch, + force: true, + }); } + log("Done syncing all submissions."); } diff --git a/src/action.js b/src/action.js index e30d991f..5bbf9afb 100644 --- a/src/action.js +++ b/src/action.js @@ -213,14 +213,6 @@ async function commit(params) { }, }); - await octokit.git.updateRef({ - owner: owner, - repo: repo, - sha: commitResponse.data.sha, - ref: "heads/" + defaultBranch, - force: true, - }); - log(`Committed solution for ${name}`); return [treeResponse.data.sha, commitResponse.data.sha]; @@ -462,6 +454,18 @@ async function sync(inputs) { commitHeader, questionData, }); + + if (i != 0) { + continue; + } + + await octokit.git.updateRef({ + owner: owner, + repo: repo, + sha: latestCommitSHA, + ref: "heads/" + defaultBranch, + force: true, + }); } log("Done syncing all submissions."); }