Triggering a Github Workflow on a new branch

Hi,

How can I trigger a workflow action when commiting on a new branch ?

Im on a feature branch, it’s only temporary, I want to rerun the Workflow Actions but It’s not triggering.

I’ve targeted all branches, but nothing is triggered.

on:

  push:

    branches:

      - '*' # matches every branch

  pull_request:

    branches:

      - '*' # matches every branch

When committing a new branch, the workflow yml file on that new branch must have the next trigger settings.

on:
  push:
    branches:
      - '*' # matches every branch
  pull_request:
    branches:
      - '*' # matches every branch
  1. When a new branch created or pushing new commit to a branch, a push event or a pull_request event occurred. And the event webhook has an associated commit SHA and Git ref.
  2. The .github/workflows directory in your repository is searched for workflow files at the associated commit SHA or Git ref. The workflow files must be present in that commit SHA or Git ref to be considered.

There is the detail explanation about what happened when triggering a workflow run: https://help.github.com/en/actions/reference/events-that-trigger-workflows#about-workflow-events

Responding to 2., "The workflow files must be present in that commit SHA or Git ref to be considered. I went through the steps in the tutorial, but when I ls for the file in my repository on my local machine, I don’t see the .github/workflows directory listed. Should I manually add folders to create .github/workflows path in my local repository then push? If I have to do that manually, why does GitHub provide an Action's tab for me to add it directly in Github?

Adding a workflow through the Actions tab just means using an editor in your browser instead of a local one. Either way you write a YAML file that defines what you want the workflow to do. It’s a matter of preference. :wink:

Okay. Thank you. I see the path in my fork’s branch to the workflow however, it isn’t triggering when I make a pr.


See, no tests run :frowning:

The conditions for running the workflow are defined in the on: section of your workflow. It’s hard to say why it’s running or not without knowing that.