As noted in the Actions docs, context.sha can represent different things in different event types. In a pull_request event, it happens not to be the sha of the head commit for some reason. Instead, in those cases you're meant to get the head sha from the pull_request payload.
This PR introduces a helper function, shaFromContext, that matches on the event type and gets the correct sha for the snapshot. I've also taken the liberty of doing a few quick test refactors.
As noted in the Actions docs,
context.sha
can represent different things in different event types. In apull_request
event, it happens not to be the sha of the head commit for some reason. Instead, in those cases you're meant to get the head sha from the pull_request payload.This PR introduces a helper function,
shaFromContext
, that matches on the event type and gets the correct sha for the snapshot. I've also taken the liberty of doing a few quick test refactors.For prior art, see: