Skip to content

Instantly share code, notes, and snippets.

@dkhmelenko
Created September 6, 2019 17:22
Show Gist options
  • Select an option

  • Save dkhmelenko/026f52a881177a93a5e0131d0a82bb20 to your computer and use it in GitHub Desktop.

Select an option

Save dkhmelenko/026f52a881177a93a5e0131d0a82bb20 to your computer and use it in GitHub Desktop.
import { Application } from 'probot'
import { PullRequestsCreateReviewParams } from '@octokit/rest'
export = (app: Application) => {
app.on(['pull_request.opened', 'pull_request.labeled'], async (context) => {
const pullRequest = context.payload.pull_request
const hasShiptItLabel: string[] = pullRequest.labels
.map((label: any) => label.name)
.includes('shipit')
if (hasShipItLabel) {
const params = context.issue({ event: 'APPROVE' })
await context.github.pullRequests.createReview(params as PullRequestsCreateReviewParams)
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment