GitHub Workflow not getting triggered for push event on other branch

I have created workflow in branch A. The workflow is set to trigger upon push event.

I didn’t add any filter based on branch. However,I notice that the workflow is getting triggered only upon push to branch A and not getting triggered when we I am pushing to other branches.

Is this behaviour normal?

How do I configure to trigger the workflow for push on all branches in that repo?

Also,how do I configure to trigger the workflow only for push to branch B,but having the workflow defined in branch A?

>>I have created workflow in branch A. The workflow is set to trigger upon push event.

I didn’t add any filter based on branch. However,I notice that the workflow is getting triggered only upon push to branch A and not getting triggered when we I am pushing to other branches.

Is this behaviour normal?

  • Yes, this is normal behavior. If you want to get a workflow be triggered by a specific branch. You need to make sure you have this workflow definition yml in that branch.

>>How do I configure to trigger the workflow for push on all branches in that repo?

  • You need to add workflow definition yml in all branches. 

>>Also,how do I configure to trigger the workflow only for push to branch B,but having the workflow defined in branch A?

  • This is not possible. You need to ensure that you have workflow defined in branch B.

In addition , if you don’t want a branch change trigger workflow, you can remove the workflow definition file from that branch.