Merge pull request #14 from lfsevergnini/fix/access-diff-directly

fix: access diff directly to enable support to private repositories
This commit is contained in:
Ville Saukkonen 2023-07-31 18:34:21 +03:00 committed by GitHub
commit 0939fc4e8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 11 deletions

9
dist/index.js vendored

@ -210,16 +210,15 @@ function main() {
const newBaseSha = eventData.before; const newBaseSha = eventData.before;
const newHeadSha = eventData.after; const newHeadSha = eventData.after;
const response = yield octokit.repos.compareCommits({ const response = yield octokit.repos.compareCommits({
headers: {
accept: "application/vnd.github.v3.diff",
},
owner: prDetails.owner, owner: prDetails.owner,
repo: prDetails.repo, repo: prDetails.repo,
base: newBaseSha, base: newBaseSha,
head: newHeadSha, head: newHeadSha,
}); });
diff = response.data.diff_url diff = String(response.data);
? yield octokit
.request({ url: response.data.diff_url })
.then((res) => res.data)
: null;
} }
else { else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME); console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

@ -213,17 +213,16 @@ async function main() {
const newHeadSha = eventData.after; const newHeadSha = eventData.after;
const response = await octokit.repos.compareCommits({ const response = await octokit.repos.compareCommits({
headers: {
accept: "application/vnd.github.v3.diff",
},
owner: prDetails.owner, owner: prDetails.owner,
repo: prDetails.repo, repo: prDetails.repo,
base: newBaseSha, base: newBaseSha,
head: newHeadSha, head: newHeadSha,
}); });
diff = response.data.diff_url diff = String(response.data);
? await octokit
.request({ url: response.data.diff_url })
.then((res) => res.data)
: null;
} else { } else {
console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME); console.log("Unsupported event:", process.env.GITHUB_EVENT_NAME);
return; return;