Problem Description
What is actually happening
When re-running the "Safe-setting validator" check via the GitHub UI (clicking Re-run on the check suite/check run for a dry-run PR check), GitHub Actions fails with:
Invalid request.
"head_sha" wasn't supplied.
This error was observed in our application logs — the GitHub UI itself gives no useful error information.
The check_suite.rerequested handler in index.js calls createCheckRun(context) with no arguments:
robot.on(['check_suite.rerequested'], async context => {
robot.log.debug('Check suite was rerequested!')
return createCheckRun(context)
})
(Note: this handler is also registered twice, back-to-back, with identical bodies.)
But createCheckRun requires head_sha to build the checks.create payload:
async function createCheckRun (context, pull_request, head_sha, head_branch) {
const { payload } = context
const res = await context.octokit.rest.checks.create({
owner: payload.repository.owner.login,
repo: payload.repository.name,
name: 'Safe-setting validator',
head_sha
})
...
}
Since no head_sha is passed in on rerequest, head_sha is undefined, and the checks.create REST call is sent without it — which the Checks API requires — producing the error above.
By contrast, every other call site (check_suite.requested, pull_request.opened, pull_request.reopened) correctly pulls head_sha out of the payload (e.g. context.payload.check_suite.head_sha or payload.pull_request.head.sha) before calling createCheckRun.
What is expected behavior
Re-running the dry-run check via the GitHub UI should re-trigger the "Safe-setting validator" check run successfully, the same way the initial check suite creation does.
The check_suite.rerequested handler should extract head_sha, head_branch, and pull_request from context.payload.check_suite (same as the existing check_suite.requested handler) and pass them into createCheckRun. The duplicate handler registration should also be removed.
Error output, if available
Invalid request.
"head_sha" wasn't supplied.
Context
Are you using the hosted instance of probot/settings or running your own?
Running our own instance.
If running your own instance, are you using it with github.com or GitHub Enterprise?
github.com
Version of probot/settings
2.1.20-rc.3 (main-enterprise @ 4578aea)
Version of GitHub Enterprise
N/A (github.com)
Problem Description
What is actually happening
When re-running the "Safe-setting validator" check via the GitHub UI (clicking Re-run on the check suite/check run for a dry-run PR check), GitHub Actions fails with:
This error was observed in our application logs — the GitHub UI itself gives no useful error information.
The
check_suite.rerequestedhandler inindex.jscallscreateCheckRun(context)with no arguments:(Note: this handler is also registered twice, back-to-back, with identical bodies.)
But
createCheckRunrequireshead_shato build thechecks.createpayload:Since no
head_shais passed in on rerequest,head_shaisundefined, and thechecks.createREST call is sent without it — which the Checks API requires — producing the error above.By contrast, every other call site (
check_suite.requested,pull_request.opened,pull_request.reopened) correctly pullshead_shaout of the payload (e.g.context.payload.check_suite.head_shaorpayload.pull_request.head.sha) before callingcreateCheckRun.What is expected behavior
Re-running the dry-run check via the GitHub UI should re-trigger the "Safe-setting validator" check run successfully, the same way the initial check suite creation does.
The
check_suite.rerequestedhandler should extracthead_sha,head_branch, andpull_requestfromcontext.payload.check_suite(same as the existingcheck_suite.requestedhandler) and pass them intocreateCheckRun. The duplicate handler registration should also be removed.Error output, if available
Context
Are you using the hosted instance of probot/settings or running your own?
Running our own instance.
If running your own instance, are you using it with github.com or GitHub Enterprise?
github.com
Version of probot/settings
2.1.20-rc.3 (main-enterprise @ 4578aea)
Version of GitHub Enterprise
N/A (github.com)