Skip to content

If condition on block or job #25980

Answered by weide-zhou
joanofdart asked this question in Actions
Discussion options

You must be logged in to vote

Hi @joanofdart,

Glad to see you in Github Community Forum!

To answer your queries:

joanofdart:

I want to stop a job from happening if the previous job didnt happen.

Jobs run in parallel by default. To run jobs sequentially, you can define dependencies on other jobs using the jobs.<job_id>.needs keyword. For example:

jobs:
  job1:
  job2:
    needs: job1

In this example, job1 must complete successfully before job2 begins, if job1 fails, the job2 will not begin.

joanofdart:
  • How do I expose a variable from the previous job?
  • How do I check for the value of this variable?

Jobs are executed on individual VM, you can transfer the variable value to the next job which needs the previous…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants