Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

fix several things #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ async function callChatGPT(api, content) {
return response;
}

function genCommentPRPrompt(title, body) {
return `Here is a pull request, please comment:\n
title: ${title}
body: ${body}
changes: `;
}

function genReviewPRPrompt(title, body, diff) {
const prompt = `Can you tell me the problems with the following pull request and describe your suggestions?
title: ${title}
Expand All @@ -38,7 +31,7 @@ ${diff}`;
}

// most @actions toolkit packages have async methods
async function run() {
function run() {
try {
const context = github.context;
const number = parseInt(core.getInput("number"));
Expand All @@ -54,12 +47,12 @@ async function run() {
if (mode == "pr") {
const {
data: { title, body },
} = await octokit.pulls.get({
} = await octokit.pull.get({
owner,
repo,
pull_number: number,
});
const { data: diff } = await octokit.rest.pulls.get({
const { data: diff } = await octokit.rest.pull.get({
owner,
repo,
pull_number: number,
Expand Down