Skip to content

Commit

Permalink
refactor: use @octokit/webhooks-types for the types of payload (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
kentaro-m authored Nov 27, 2021
1 parent 8af7ad5 commit 76e3c7a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"lodash": "^4.17.20"
},
"devDependencies": {
"@octokit/webhooks-types": "^4.17.1",
"@types/jest": "^27.0.2",
"@types/js-yaml": "^3.12.1",
"@types/lodash": "^4.14.141",
Expand Down
4 changes: 3 additions & 1 deletion src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as github from '@actions/github'
import { Context } from '@actions/github/lib/context'
import * as utils from './utils'
import { PullRequest } from './pull_request'
import { PullRequestEvent } from '@octokit/webhooks-types'

export interface Config {
addReviewers: boolean
Expand Down Expand Up @@ -32,7 +33,8 @@ export async function handlePullRequest(
throw new Error('the webhook payload is not exist')
}

const { title, draft, user, number } = context.payload.pull_request
const { pull_request: event } = context.payload as PullRequestEvent
const { title, draft, user, number } = event
const {
skipKeywords,
useReviewGroups,
Expand Down

0 comments on commit 76e3c7a

Please sign in to comment.