I want to automatically create a Github issue with an action if a job fails. In this issue, I want to include the log in the issue body but I can't figure out how to get this log.
I've tried using the Github CLI gh run view --log-failed --job <jobID>
. However, this requires the job ID, which is tough to impossible to get for a matrix job. I've tried this action, but my matrix uses a stringified JSON matrix value which creates a truncated job name so this doesn't solve the problem reliably. Also, when trying this command locally, I receive an empty response with the --log
or --log-failed
flags.
I am currently creating the issue in the same job as the failing one using if: ${{ failure() }}
.
Any tips or ideas for how I can auto-create an issue containing job failure logs in the body? Too many yaks are getting shaved.