diff --git a/out/github-action.cjs b/out/github-action.cjs index f569230..754ebc0 100644 --- a/out/github-action.cjs +++ b/out/github-action.cjs @@ -18916,10 +18916,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); command_1.issueCommand("error", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } exports2.error = error2; - function warning(message, properties = {}) { + function warning2(message, properties = {}) { command_1.issueCommand("warning", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } - exports2.warning = warning; + exports2.warning = warning2; function notice(message, properties = {}) { command_1.issueCommand("notice", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } @@ -93624,12 +93624,13 @@ async function getCommitDiff(commitSha) { commitSha, "diff" ); - return { - sha: commitSha, - diff: response.data - }; + const diff2 = response.data ?? ""; + if (!diff2) { + core.warning(`No diff data for commit ${commitSha}`); + } + return { sha: commitSha, diff: diff2 }; } catch (error2) { - core.error(`Failed to fetch Gitea/Forgejo commit diff: ${error2}`); + core.error(`Error fetching Gitea/Forgejo diff for ${commitSha}: ${error2}`); throw error2; } } @@ -93639,12 +93640,14 @@ async function getCommitDiff(commitSha) { 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 }; } async function improveMessagesInChunks(diffsAndSHAs) { const chunkSize = diffsAndSHAs.length % 2 === 0 ? 4 : 3; diff --git a/src/github-action.ts b/src/github-action.ts index 95d446e..f2049d0 100644 --- a/src/github-action.ts +++ b/src/github-action.ts @@ -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( '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;