-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (29 loc) · 883 Bytes
/
Copy pathindex.js
File metadata and controls
32 lines (29 loc) · 883 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
29
30
31
32
const core = require('@actions/core')
const github = require('@actions/github')
const { GitHub } = require('@actions/github/lib/utils')
const { createAppAuth } = require('@octokit/auth-app')
const eventPayload = require(process.env.GITHUB_EVENT_PATH)
const { owner, repo } = github.context.repo
const appId = core.getInput('appid', { required: true })
const privateKey = core.getInput('privatekey', { required: true })
const installationId = core.getInput('installationid', { required: true })
const installationOctokit = new GitHub({
authStrategy: createAppAuth,
auth: {
appId,
privateKey,
installationId
}
})
;(async () => {
try {
await installationOctokit.rest.pulls.createReview({
owner,
repo,
pull_number: eventPayload.pull_request.number,
event: 'APPROVE'
})
} catch (error) {
core.setFailed(error.message)
}
})()