Is it possible to keep workflows in hold for different branch

I have a config.yml with the following workflow configuration.

workflows:
  version: 2
  production:
    jobs:
      - build:
          filters:
            branches:
              only:
                - master
      - push:
          requires:
            - build
      - deploy_prod:
          requires:
            - push
          context: PRODUCTION
      - test_prod:
          requires:
            - deploy_prod
          context: PRODUCTION
  
  development:
    jobs:
      - build:
          filters:
            branches:
              only:
                - develop
      - push:
          requires:
            - build
      - deploy_dev:
          requires:
            - push
          context: DEVELOP
      - test_dev:
          requires:
            - deploy_dev
          context: DEVELOP
                  
  test:
    jobs:
      - build:
          filters:
            branches:
              only:
                - test
      - push:
          requires:
            - build
      - deploy_test:
          requires:
            - push
          context: TEST
      - test_test:
          requires:
            - deploy_test
          context: TEST

Currently whenever I push any changes to any of the branches master, develop, test the jobs are triggered.
To simplify, whenever I push changes to the develop branch my job is being run as per the requirement so as for another branch.

My requirement
Hold the workflow of either develop or test branch when push is carried out to both develop and test branch at the same time, and execute only one workflow in such cases? So, develop workflow will be executed first and then the test workflow will be executed.

But also, if the push is done to the only one the branch either test, develop or master only, the respective workflow should be executed irrespective of the other branch’s workflow.

1 Like