@@ -12,9 +12,9 @@ const createChecks = async (context, payload, actionObj) => {
12
12
// Note: octokit (wrapped by probot) requires head_branch.
13
13
// Contradicting API docs that only requires head_sha
14
14
// --> https://developer.github.com/v3/checks/runs/#create-a-check-run
15
- if ( context . payload . checksuite ) {
16
- params . head_branch = context . payload . checksuite . head_branch
17
- params . head_sha = context . payload . checksuite . head_sha
15
+ if ( context . payload . check_suite ) {
16
+ params . head_branch = context . payload . check_suite . head_branch
17
+ params . head_sha = context . payload . check_suite . head_sha
18
18
} else if ( context . eventName === 'issue_comment' ) {
19
19
const issueNumber = context . payload . issue . number
20
20
const pullRequest = ( await actionObj . githubAPI . getPR ( context , issueNumber ) ) . data
@@ -104,6 +104,9 @@ class Checks extends Action {
104
104
}
105
105
106
106
async beforeValidate ( context , settings , name ) {
107
+ if ( context . eventName === 'issue_comment' && ! context . payload . issue ?. pull_request ) {
108
+ return Promise . resolve ( )
109
+ }
107
110
const result = await createChecks ( context , {
108
111
status : 'in_progress' ,
109
112
output : {
@@ -127,10 +130,16 @@ class Checks extends Action {
127
130
}
128
131
129
132
async run ( { context, settings, payload } ) {
133
+ if ( context . eventName === 'issue_comment' && ! context . payload . issue ?. pull_request ) {
134
+ return Promise . resolve ( )
135
+ }
130
136
await createChecks ( context , payload , this )
131
137
}
132
138
133
139
async afterValidate ( context , settings , name , results ) {
140
+ if ( context . eventName === 'issue_comment' && ! context . payload . issue ?. pull_request ) {
141
+ return Promise . resolve ( )
142
+ }
134
143
const checkRunResult = this . checkRunResult . get ( name )
135
144
const payload = settings . payload ? this . populatePayloadWithResult ( settings . payload , results , context ) : undefined
136
145
0 commit comments