Github Action error handling

I’m working on a custom Github Action which creates a Bug Work item in Azure DevOps after a failed action in a Github Workflow.

How do I retrieve during the Workflow run information about the last status (error) of an action in a workflow?

Stefan Stranger

Github Actions provide job context which inclue job.status. It shows the current status of the job. Possible values are success, failure, or cancelled. 

You could use job.status as an input variable value of your custom actions. And you need to add this custom action at the last step of a job, also add if : always() to ensure it to run even if the former steps failed or canceled. 

- name: show job status
       if: always()
       run: echo $status
         status: ${{job.status}}