Skip to content

Commit

Permalink
build update
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 committed Feb 15, 2023
1 parent bb605aa commit 85a1612
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions action/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -160120,18 +160120,20 @@ const robot = (app) => {
pull_request.draft) {
return;
}
const data = await context.octokit.request(`GET /repos/{owner}/{repo}/compare/{basehead}`, {
const data = await context.octokit.repos.compareCommits({
owner: repo.owner,
repo: repo.repo,
basehead: `${context.payload.pull_request.base.sha}...${context.payload.pull_request.head.sha}`,
base: context.payload.pull_request.base.sha,
head: context.payload.pull_request.head.sha,
});
let { files: changedFiles, commits } = data.data;
if (context.payload.action === 'synchronize') {
if (commits.length >= 2) {
const { data: { files }, } = await context.octokit.request(`GET /repos/{owner}/{repo}/compare/{basehead}`, {
const { data: { files }, } = await context.octokit.repos.compareCommits({
owner: repo.owner,
repo: repo.repo,
basehead: `${commits[commits.length - 2].sha}...${commits[commits.length - 1].sha}`,
base: commits[commits.length - 2].sha,
head: commits[commits.length - 2].sha,
});
const filesNames = files?.map((file) => file.filename) || [];
changedFiles = changedFiles?.filter((file) => filesNames.includes(file.filename));
Expand Down

0 comments on commit 85a1612

Please sign in to comment.