From 19528c09d916d399faf1023838367ecf7daf2402 Mon Sep 17 00:00:00 2001 From: Julian Gruber Date: Mon, 26 Feb 2024 00:19:10 -0800 Subject: [PATCH] Fix GitHub API. Closes #71 (#72) * test * add build during ci * update github api --- .github/workflows/ci.yml | 4 ++++ index.js | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 76c2ce19..799977bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,10 @@ jobs: steps: - name: Checkout uses: actions/checkout@v1 + - name: npm install and build + run: | + npm ci + npm run build - name: Approve Pull Request uses: ./ with: diff --git a/index.js b/index.js index 0bd06bfc..92e5cc8e 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict' const core = require('@actions/core') -const { GitHub, context } = require('@actions/github') +const github = require('@actions/github') const main = async () => { const token = core.getInput('github-token') @@ -13,12 +13,12 @@ const main = async () => { const [owner, repo] = repoString.split('/') repoObject = { owner, repo } } else { - repoObject = context.repo + repoObject = github.context.repo } - const octokit = new GitHub(token) + const octokit = github.getOctokit(token) - await octokit.pulls.createReview({ + await octokit.rest.pulls.createReview({ ...repoObject, pull_number: number, event: 'APPROVE'