I have the workflow that contains 3 jobs, and I want to have 4th job that will send a slack message for me.
Could you please advise how to get the status of all jobs and their statuses that currently is on workflow.
The suggestion about putting all the jobs in one not an option
name: CI on: push: branches: - master jobs: one: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - run: echo "one" two: runs-on: ubuntu-latest steps: - run: echo "two" five: runs-on: ubuntu-latest needs: [one, two] if: always() steps: - run: echo "How to know the status of execution of jobs.one and jobs.two?"
Solved! Solved! Go to Solution.
The one thing that I found is using of Check API https://developer.github.com/v3/activity/events/types/#checksuiteevent
but this approach looks like a dirty workaround
Now, github actions provide workflow jobs APIs , you could use it to list all the jobs of a workflow run.
And there is an environment variable GITHUB_RUN_ID you could use to get the current workflow run id.
You could get the conclusion element value for job status.
There is another method to pass job status through artifacts, for more information, please check BrightRan's solution here:
Take a look at the Workflow Conclusion Action. It checks the status of the other jobs in your workflows, and will create an environment variable with a rolled up status. It works well if you need to do something conditionally on the basis of the other jobs.