Feature request and use case example to allow matrix
in if
s
#25622
-
Currently, using We’re building an E2E test suite at https://github.com/timberio/vector, and want to use matrices and labels to conditionally skip some of the test cases. Here’s an example of what we’d like to have:
This is a simplified example, to demonstrate the point. The idea is we’d like to have a way to only run the full test suite in a nightly build, or if the PR has a certain label ( The listing above doesn’t work, because currently we can’t use We’d like to have the access to We’ve also considered using UPD 1: Another notable issue we encountered as a consequence of the inability to use |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hi @mozgiii, Glad to see you in Github Community Forum! Currently Actually i’m a little confused with your if expression, since you use It’s not supported to change the step outcome, but cancel the whole job, you can try to use andymckay/cancel-action@0.2 Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hi @weide-zhou, There was a bug in the if condition, the correct version would be
Notice there’s a different condition at the second part of the I think this is a good way to explain the logic we’re trying to achieve:
In that sense - we first check if the test is essential - and if it is we always run the said test - otherwise check the context we’re executing at, and sometimes run the test even if it’s not essential.
I’ve looked into |
Beta Was this translation helpful? Give feedback.
-
Hi @mozgiii, Thanks for your reply! Github support dynamic matrix value now. Based on your logic, you can add a
Confirmed it works on my side. For exmaple: Please refer to the doc for more details. Thanks |
Beta Was this translation helpful? Give feedback.
-
Wow, amazing! A very nice solution! I didn’t have a clue to look into that direction. Github definitely should explicitly add a hint to the matrix doc that matrix can be assigned that way. Thanks a lot, I’ll try this! UPD: Works like a charm, thanks again! |
Beta Was this translation helpful? Give feedback.
-
This still doesn’t appear to work with |
Beta Was this translation helpful? Give feedback.
Hi @mozgiii,
Thanks for your reply!
Github support dynamic matrix value now. Based on your logic, you can add a
prejob
and set the matrix value accordingly(events&pr labels) , transfer the matrix value to your test job. In this case, you don’t need to cancel the redundant jobs.Code sample as below(please change the matrix value for yours):