Retrieve the error message from a github actions failed job

Viewed 16

Assuming I have two jobs and the second depends on the first one:

jobs:

  job-1:
    runs-on: ubuntu-latest 
  
    steps:
      - uses: somerepo/someaction@v1

      - uses: anotherrepo/anotheraction@v1

      - bash: shell
        run: |
          do-a-lot-of-stuff


  job-2:
    runs-on: ununtu-latest
    needs: job-1
    if: failure()

   steps:
     - shel: bash
       run: echo ${{ needs.job-1.fail.message }}

Is there a way to capture the failure message from job-1?

(from whichever step failed of course)

0 Answers
Related