Refactor using gitea-js.
Testing / prettier (push) Failing after 2m23s
Testing / e2e-test (20.x) (push) Failing after 2m44s
Testing / unit-test (20.x) (push) Failing after 3m46s

This commit is contained in:
2026-01-04 14:15:51 -05:00
parent a3303b9516
commit 7fefe34240
2 changed files with 28 additions and 23 deletions
+14 -12
View File
@@ -48,34 +48,36 @@ async function getCommitDiff(commitSha: string): Promise<{ sha: SHA; diff: Diff
'diff'
);
return {
sha: commitSha,
diff: response.data,
};
const diff = response.data ?? '';
if (!diff) {
core.warning(`No diff data for commit ${commitSha}`);
}
return { sha: commitSha, diff };
} catch (error) {
core.error(`Failed to fetch Gitea/Forgejo commit diff: ${error}`);
core.error(`Error fetching Gitea/Forgejo diff for ${commitSha}: ${error}`);
throw error;
}
}
// GitHub path unchanged
const diffResponse = await octokit.request<string>(
'GET /repos/{owner}/{repo}/commits/{ref}',
{
owner,
repo,
ref: commitSha,
headers: {
Accept: 'application/vnd.github.v3.diff',
},
headers: { Accept: 'application/vnd.github.v3.diff' },
}
);
return { sha: commitSha, diff: diffResponse.data };
const diff = diffResponse.data ?? '';
if (!diff) {
core.warning(`No diff data from GitHub for commit ${commitSha}`);
}
return { sha: commitSha, diff };
}
interface DiffAndSHA {
sha: SHA;
diff: Diff;