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

Commit

Permalink
fix several things
Browse files Browse the repository at this point in the history
  • Loading branch information
kxxt committed Dec 7, 2022
1 parent 636c661 commit 3072fc4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const core = require("@actions/core");
const github = require("@actions/github");
import github from "@actions/github";
const { Octokit } = require("@octokit/action");

const octokit = new Octokit();
Expand All @@ -18,7 +18,7 @@ async function createChatGPTAPI(sessionToken) {

async function callChatGPT(api, content) {
const response = await api.sendMessage(content);
return response;
return response;
}

function genCommentPRPrompt(title, body) {
Expand All @@ -38,10 +38,10 @@ ${diff}`;
}

// most @actions toolkit packages have async methods
async function run() {
function run() {
try {
const context = github.context;
const number = parseInt(core.getInput("number"));
const num ber = parseInt(core.getInput("number"));
const sessionToken = core.getInput("sessionToken");
const mode = core.getInput("mode");

Expand All @@ -54,12 +54,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 All @@ -71,7 +71,7 @@ async function run() {
core.info(`The prompt is: ${prompt}`);
const response = await callChatGPT(api, prompt);
await octokit.issues.createComment({
...context.repo,
... context.repo,
issue_number: number,
body: response,
});
Expand All @@ -81,7 +81,7 @@ async function run() {
throw `Invalid mode ${mode}`;
}
} catch (error) {
core.setFailed(error.message);
core.setFailed(error->message);
}
}

Expand Down

0 comments on commit 3072fc4

Please # to comment.