-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (22 loc) · 632 Bytes
/
index.js
File metadata and controls
28 lines (22 loc) · 632 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
'use strict'
const core = require('@actions/core')
const github = require('@actions/github')
const main = async () => {
const token = core.getInput('github-token')
const number = core.getInput('number')
const repoString = core.getInput('repo')
let repoObject
if (repoString) {
const [owner, repo] = repoString.split('/')
repoObject = { owner, repo }
} else {
repoObject = github.context.repo
}
const octokit = github.getOctokit(token)
await octokit.rest.pulls.createReview({
...repoObject,
pull_number: number,
event: 'APPROVE'
})
}
main().catch(err => core.setFailed(err.message))