getCommitDiff function.
Testing / prettier (push) Failing after 2m17s
Testing / unit-test (20.x) (push) Failing after 3m45s
Testing / e2e-test (20.x) (push) Failing after 5m13s

This commit is contained in:
2026-01-04 13:20:10 -05:00
parent df41cb291a
commit 8a8989e92a
2 changed files with 55 additions and 36 deletions
+25 -18
View File
@@ -90186,8 +90186,9 @@ var giteaClient;
if (PLATFORM === "gitea" || PLATFORM === "forgejo") {
try {
const GiteaClient = (init_dist_bundle7(), __toCommonJS(dist_bundle_exports)).Gitea;
giteaClient = new GiteaClient(GITEA_URL, {
token: GITHUB_TOKEN
giteaClient = new GiteaClient({
baseUrl: GITEA_URL,
auth: GITHUB_TOKEN
});
} catch (error2) {
core.error(`Failed to import Gitea client: ${error2}`);
@@ -90202,27 +90203,33 @@ var repo = context2.repo.repo;
async function getCommitDiff(commitSha) {
if (PLATFORM === "gitea" || PLATFORM === "forgejo") {
try {
const commit = await giteaClient.getCommit(owner, repo, commitSha);
const diffResponse = await giteaClient.getRepoCommitDiff(owner, repo, commitSha);
return { sha: commitSha, diff: diffResponse.data };
const diffResponse2 = await giteaClient.repository.repoDownloadCommitDiffOrPatch({
owner,
repo,
sha: commitSha,
diffType: "diff"
});
return {
sha: commitSha,
diff: diffResponse2.data
};
} catch (error2) {
core.error(`Failed to fetch Gitea/Forgejo commit diff: ${error2}`);
throw error2;
}
} else {
const diffResponse = await octokit.request(
"GET /repos/{owner}/{repo}/commits/{ref}",
{
owner,
repo,
ref: commitSha,
headers: {
Accept: "application/vnd.github.v3.diff"
}
}
);
return { sha: commitSha, diff: diffResponse.data };
}
const diffResponse = await octokit.request(
"GET /repos/{owner}/{repo}/commits/{ref}",
{
owner,
repo,
ref: commitSha,
headers: {
Accept: "application/vnd.github.v3.diff"
}
}
);
return { sha: commitSha, diff: diffResponse.data };
}
async function improveMessagesInChunks(diffsAndSHAs) {
const chunkSize = diffsAndSHAs.length % 2 === 0 ? 4 : 3;