Feature Request: A job being skipped should not also skip all jobs that depend on it by transitive relation

Suppose I have this dependency chain of job:
A → B → C

When B needs A and C needs B. IMPORTANT: C does not need A.

The problematic case is that when A is skipped, C is also skipped regardless of whether B is skipped or not. I don’t think this is desirable because C does not declare that it needs A.

F.ex imagine “A” as a job that populates a cache, B is a job that we want to executed after A, and C is a job that needs the output of B.

The control flow of Github Actions leave a lot to be desired. I think this problem can be solved if we don’t conflate “B depends on A” and “B must be executed after A”.

1 Like

If B needs A, how is it possible that A is skipped, but B is not?

1 Like

If B needs A, how is it possible that A is skipped, but B is not?

Possible if B has the conditional if: always(), very common thing if A is an “optional” step as I described in the post above.

So you have

    # ...

    needs: a
    if: always()
    # ...

    needs: b
    # ...

and a gets skipped, b runs, but c gets cancelled? If my guess is wrong, please post the outline of your workflow.

Thanks for this feedback, @lackhoa! We’re always working to improve GitHub and the GitHub Support Community. Please submit your feedback via our feedback form so that our product team can track your request(s).

1 Like

Yes, your pseudo-code is what I have in mind. You can test it out if you don’t believe me.

I don’t know why you deleted your post, but I’ll reply to your point since I’ve thought of that as well. Let me paraphrase it (I don’t quote because I suppose you wouldn’t want that)

Why not make the optional “job A” a step / a series of steps?

The reason why it’s cumbersome to do, is that a job can’t be converted to a step just like that.

  • Again, since GHA’s control flow is lacking, there is no easy to way skip a bunch of steps. The only way I know how to do that is to put "if"s in all of them (trust me it doesn’t look pretty when you have lots of steps, like the workflow I’m working on).
  • I want job A to be executed in parallel with another job.
  • If a series of steps can be executed independently without prior state (or if it wants to setup its own state), you’d want it to be its own job. It aids in understandability and reusability.

So the bottom line is that I want/need A to be a job.

Hi @tuves, I have no problem submitting a feedback, but can I just link to this thread in the feedback form? Would be a pain to repeat the point just to put it in a different format.
Edit: well I submitted a ticket and linked to this thread anyway. Don’t know if you guys like that but you’ll have to live with it now :slight_smile: