honeycombio/gha-buildevents

Detect if the job failed in the post action

Closed this issue · 3 comments

This is a tracking issue.

We use a 'wrapping action', which means we can always execute a bit of code when the job finishes. We use this post action for building and transmitting the final trace (i.e. buildevents build).

Unfortunately, it's not possible to detect in this section whether the build failed or not.

The current workaround is to check for an environment variable BUILD_SUCCESS. The user of gha-buildevents is responsible for setting this variable as last step in the build, which is not ideal.

Tried to detect failure by using the GitHub API. Using the Get a workflow job API.

Conclusion: still not sufficient information.

The response contains a status fields that will typically be set to in_progress during the workflow and a conclusion which is still set to null at this point.

Found a solution 💡 Inputs to the action are re-evaluated when passed to the post section. So if you an input ${{ job.status }} is effectively updated with the status at the end of the regular steps.

Debug output:
Screenshot 2020-04-29 at 03 00 14