Single item matrix is excluded but still runs job #26647
-
I have a GitHub action job that has a single value in the matrix sometimes (since the matrix’s content is dynamic), but I want to exclude a certain item. However, if it’s a single item matrix (like one parameter and the array only has one item), how would I skip the job? Currently, the job keeps running, but it shouldn’t. Here’s the workflow:
So what eventually happens is |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You should be able to extend the Then the subsequent job conditional stays as-is, the exclude can be dropped from the matrix config. You could also add the project path that you never want this workflow to run as part of the
Then it just won’t ever trigger on changes to anything in that path. Which is way cleaner than triggering the workflow and running the changes job unnecessarily. |
Beta Was this translation helpful? Give feedback.
You should be able to extend the
if:
to something like this:${{ (needs.changes.outputs.packages != '[]' && needs.changes.outputs.packages != '[something]') }}
, or fix up the changes job to omit the ‘something’ package from the output, either up front before the changes output value is populated (detected changes to an env var with a variable substitution dropping something from the list) or by manipulating the changes output values as a final step in the changes job with a sed or whatever and updating the output with that outcome with anotherrun: echo "::set-output name=changes::blah,blarg"
which would replace the existing values.Then the subsequent job conditional stays as-is, the exc…