Reusable workflows with skipped internal jobs cause dependents to be auto-skipped #189172
Replies: 4 comments
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
Great write-up of the issue. You're right that this breaks the abstraction — reusable workflows are supposed to be opaque units but the current needs evaluation leaks internal job structure to callers. |
|
I think it is about time that GitHub introduced the concept of ordering jobs without defining them as dependencies... If they would allow us to order jobs without defining them as dependencies, all these ugly workarounds would no longer be necessary. For example a |
|
@Anghel01, can you elaborate what you mean with the following statement: What does this solve? If your workflow fails it will suddenly show up as green because of that? Am I seeing that wrong? |
Uh oh!
There was an error while loading. Please reload this page.
Problem
When a job depends on a reusable workflow via
needs, GitHub evaluates the result by looking at individual jobs inside the reusable workflow rather than the reusable workflow as a whole. If any internal job is skipped (e.g. optional tests gated by an input flag), this non-success status leaks to the caller and auto-skips downstream jobs — even when the reusable workflow functionally succeeded.Reusable workflows are meant to be opaque units of work. Callers should not need to know or care about internal job structure. But today,
needsbreaks this abstraction by evaluating individual sub-jobs instead of the workflow-level result.Reproduction
When
run_tests: false, theoptional-testjob is skipped internally. Thedeployjob is then auto-skipped becauseneedssees the skipped sub-job — even thoughbuildsucceeded and the reusable workflow as a whole completed without failures.Expected behavior
needs: [pipeline]should report the result of the reusable workflow as a unit, not the results of individual jobs within it. A reusable workflow where all non-skipped jobs succeed should reportsuccessto the caller, regardless of how many optional internal jobs were skipped.Current workaround
Use
!cancelled() && !failure()on every job that depends on a reusable workflow:This overrides the auto-skip but is a non-obvious workaround that every consumer must remember to apply. It defeats the purpose of reusable workflows being self-contained abstractions.
Proposal
needsshould evaluate a reusable workflow's result at the workflow level, not by inspecting individual internal jobs:successfailureskippedcancelledThis would make reusable workflows truly composable without requiring callers to know about their internal job structure.
All reactions