Skip to content

Commit

Permalink
chore(action): fixed issue with var
Browse files Browse the repository at this point in the history
  • Loading branch information
DarrellRichards committed Jun 2, 2024
1 parent 042c527 commit dd04a67
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ async function validateCode(diff: File[], details: Details) {
return [];
}

if (!result.required_changed) {
return [];
}

return {
body: result.review,
path: file.to,
position: Number(result.lineNumber),
required_changed: result.required_changed,
};
});

Expand Down Expand Up @@ -131,27 +136,29 @@ async function main() {
const { action, repository, number, before, after } = JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH || "", "utf-8"))
const { title, description, patch_url, diff_url } = await PRDetails(repository, number);

if (action === "opened") {
// Generate a summary of the PR since it's a new PR
const data = await gitDiff(repository.owner.login, repository.name, number);
const data = await gitDiff(repository.owner.login, repository.name, number);
dif = data as unknown as string;
} else if (action === "synchronize") {
const newBaseSha = before;
const newHeadSha = after;
// if (action === "opened") {
// // Generate a summary of the PR since it's a new PR
// const data = await gitDiff(repository.owner.login, repository.name, number);
// dif = data as unknown as string;
// } else if (action === "synchronize") {
// const newBaseSha = before;
// const newHeadSha = after;

const data = await compareCommits({
owner: repository.owner.login,
repo: repository.name,
before: newBaseSha,
after: newHeadSha,
number
})
// const data = await compareCommits({
// owner: repository.owner.login,
// repo: repository.name,
// before: newBaseSha,
// after: newHeadSha,
// number
// })

dif = String(data);
} else {
console.log('Unknown action', process.env.GITHUB_EVENT_NAME);
return;
}
// dif = String(data);
// } else {
// console.log('Unknown action', process.env.GITHUB_EVENT_NAME);
// return;
// }

if (!dif) {
// Well shit.
Expand Down

0 comments on commit dd04a67

Please sign in to comment.