Github Action: Trigger a workflow from another branch

I have two branches: feat and master.
feat doesn’t have a .github folder.
master has one with the following trigger:

on:
  push:
    branches:
      - feat

When I push something on feat, the workflow on the master branch isn’t triggered. Is there any away around it ?

As far as I’m aware, no. You’ll have to add the workflow to the feat branch if you want it to trigger on push.

@scipionh,

We have no method to trigger a workflow in a branch by the push event occurs in another branch.

Every workflow run has two important properties branch/tag ref (github.ref) and commit SHA (github.sha). Each workflow has only one branch/tag ref and only one commit SHA.

When you push a new commit to the feat branch in your repository, generally GitHub will do the following things before triggering workflows.

  • In the feat branch, check if there is any workflow file in the latest version (commit SHA) of the repository files. If no any workflow file, no workflow run will be triggered. If no any workflow file, no workflow run will be triggered.

  • If find some existing workflow files, check the trigger events set in the workflow files. Whether the event names (github.event_name) have included push event, and the branches filter have includes feat branch. If no matched trigger events in the workflow files, no workflow run will be triggered.

  • If have matched trigger events in the workflow files, trigger the workflows that have the matched trigger events.