Update main.ts (#29)

Add support for the new `pull_request_target` event.
https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request_target
This commit is contained in:
Rob Dodson 2020-08-13 12:44:57 -07:00 committed by GitHub
parent e1ae9889cb
commit b365bd8768
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ function getConfigFileContent(configPath: string): string {
}
async function getChangedFiles(token: string): Promise<string[] | null> {
if (github.context.eventName === 'pull_request') {
if (github.context.eventName === 'pull_request' || github.context.eventName === 'pull_request_target') {
const pr = github.context.payload.pull_request as Webhooks.WebhookPayloadPullRequestPullRequest
return token ? await getChangedFilesFromApi(token, pr) : await getChangedFilesFromGit(pr.base.sha)
} else if (github.context.eventName === 'push') {