Require logic for jobs and branch names

I have a config with a workflow like the following:

workflows:
  myworkflow:
    jobs:
      - test:
          filters:
              branches:
                ignore: foo
      - myjob:
          requires: [test]

When I make a change to a branch named foo I expect myjob to run and test not to run, but this is not the case. Instead nothing happens. Is there a way I can achieve only myjob running, without duplicating myjob for both branches named foo and others?

This seems like the correct / expected behavior if I’m understanding you properly – since myjob requires test, it should not run if the filter prevents test from running.

Is having myjob require test on other branches to save money / credits if test fails, or does it actually need to run first?

Maybe you can give a little more context about what your goal is, and maybe people will be able to help think of some options?

Image the ignored branch for tests is the trunk of the repository. In this case it may be desired to run test on any branch that his not the trunk, and still build an artifact for the branch myjob.

I think the syntax is confusing because if there is another job that requires test alongside another job, it may still run for the foo branch. Here’s an example:

workflows:
  myworkflow:
    jobs:
      - build
      - test:
          filters:
              branches:
                ignore: foo
          requires: [build]
      - myjob:
          requires: [test, build]

In this case, foo will trigger myjob but it still requires test.