Skip to content

Commit 19528c0

Browse files
authored
Fix GitHub API. Closes #71 (#72)
* test * add build during ci * update github api
1 parent 3b184ad commit 19528c0

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ jobs:
66
steps:
77
- name: Checkout
88
uses: actions/checkout@v1
9+
- name: npm install and build
10+
run: |
11+
npm ci
12+
npm run build
913
- name: Approve Pull Request
1014
uses: ./
1115
with:

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
const core = require('@actions/core')
4-
const { GitHub, context } = require('@actions/github')
4+
const github = require('@actions/github')
55

66
const main = async () => {
77
const token = core.getInput('github-token')
@@ -13,12 +13,12 @@ const main = async () => {
1313
const [owner, repo] = repoString.split('/')
1414
repoObject = { owner, repo }
1515
} else {
16-
repoObject = context.repo
16+
repoObject = github.context.repo
1717
}
1818

19-
const octokit = new GitHub(token)
19+
const octokit = github.getOctokit(token)
2020

21-
await octokit.pulls.createReview({
21+
await octokit.rest.pulls.createReview({
2222
...repoObject,
2323
pull_number: number,
2424
event: 'APPROVE'

0 commit comments

Comments
 (0)