157

I have a GitHub action workflow file @ myrepo/.github/workflows/Build Webpage.yml it contains this:

name: Webpage Build

on:
  push:
    branches:
      - webpage 

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: setup node
      uses: actions/setup-node@v2-beta
      with:
        node-version: '12'
    - name: install deps and predeploy
      run: |
        npm ci
        npm run predeploy
    - name: Deploy 
      uses: JamesIves/[email protected]
      with:
        GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
        BRANCH: gh-pages
        FOLDER: build

When I push to the webpage branch nothing happens in the actions tab at all I can't tell if I have a syntax error or if something is completely not set up correctly, I have in past on this repo had errors relating to syntax like every step must define a 'uses' or 'run' key which to me shows Github does recognize the workflow

13
  • 1
    does github still complain about the syntax? Commented May 24, 2020 at 20:39
  • 1
    No, no matter what I push to nothing happens, no complaints no errors that I can see Commented May 24, 2020 at 20:43
  • 1
    If you are absolutely sure you are pushing to the webpage branch, and still the workflow is not being triggered, then you need to head over to the official actions community page and submit a bug report Commented May 24, 2020 at 20:46
  • 2
    If you want to debug it further, another option is to change the trigger to run on a schedule, and see if that triggers the workflow... Commented May 24, 2020 at 20:52
  • 6
    found it was confused with basic git file... Im an idiot obvs XD, just pushed the workflow up and its running so that looks fine, so in short make sure the workflows on the branch you want it to run on. I thought I saw it in a doc somewhere but couldn't find it. Thanks a bunch Commented May 24, 2020 at 21:38

30 Answers 30

284

Is your branch master or main?

It might be silly in the future but as for October 2020 just keep in mind that the default GitHub branch has been renamed from master to main (source).

So if you are copypasting actions from elsewhere, make sure that you are targeting the correct branch (for new repos this means most of the time to replace master with main in the .yml workflow files).

If you are targeting the wrong branch, the name of the action will appear on GitHub but no actions will actually run.

Sign up to request clarification or add additional context in comments.

3 Comments

If you made this change but it wasn't fixed, also see sachinkondana's answer: if the workflow file was all that changed, and wasn't included in paths, the workflow won't run until something matching paths is changed.
[[ FACEPALM ]] : This is exactly what I did. Had me chasing my tail for quite some time. Just went ahead and did this: ` branches:` [ "master", "main" ]
Something similar happened to me. I had .github/workflow instead of .github/workflows . Hope this may help some.
198

In my case there was a Github actions outage. Check https://www.githubstatus.com/

Comments

80

So as found in the comment below the post itself, if you want the workflow to run on branch x the .github folder must be on branch x and any other branch you want to trigger the workflow from

3 Comments

We ran into this issue when migrating from another provider to github/github actions, with a branch that predated the migration. It was very confusing :)
This is a case that can be missed by many users. Just copy the .github folder to your local working branches.
I have a nested folder where my .workflows is inside another folder. Could this be the reason my actions are not running?
39

Another scenario: if you already have a workflow file in your project and the paths are set, the workflow will not execute unless changes are made within the specified path folder. Any modifications to the workflow file located outside the defined path will not trigger the Action.

on:
  push:
    branches:
     - master
    paths:
     - 'packages/container/**'

Comments

28
  • Another silly case scenario that happened to me. As the GitHub UI adds spaces to the folders path (sometimes this is caused by the Google Translate plugin), when I copied the path .github/workflows from the GitHub UI and used it to create folders in VSCode, it was .github / workflows with spaces around the /.

GitHub workflow path

  • I caught this by asking GitHub to initialize the Actions workflow for me from the Actions tab, so I noticed my mistake, and that's a good way to solve this issue.

GitHub Actions UI

1 Comment

i wasnot making the exact mistake but using workflow instead of workflows. This comment helped me find the error. :D
23

Other possibility that can occur on a workflow is the following with pull_request type.

If there are conflicts with your branch and base branch, workflow will not trigger. It's not always obvious because it's possible that the only conflicts you have is with workflows.

Just an example below, but main point is conflicts must be resolved first.

on:
  pull_request:
    types: [labeled, reopened, synchronize, ready_for_review]

1 Comment

21

Just wanted to add a silly case scenario that happened to me. Whenever you add a new workflow, sometimes it may happen that workflow may not get into the running phase even after everything is specified correctly. Just make sure to make some changes in whatever branch you are running the action in after adding the action itself. Make sure to commit these changes as well. This will trigger the action to run and show up on the dashboard.

1 Comment

This just happened to me. I changed a workflow and it wouldn't trigger any runs. Changed a random unrelated file and then it worked again.
17

A further trap to look out for: If you fork another repository which has a Github workflow, workflows will be disabled in your fork by default.

The intention of this feature is to prevent you from accidentally running an imported workflow with unknown behavior, which might pose a security hazard (e.g. by accessing secrets).

To re-enable workflows, go to the "Actions" tab of the repository and confirm that you understand the workflows you are about to enable.

1 Comment

Could you elaborate on that? It seems that this is what is happening to me.
14

The last gotcha to be aware, are the skip keywords in the commit that triggers the action.

If any commit message in your push or the HEAD commit of your PR contains the strings [skip ci], [ci skip], [no ci], [skip actions], or [actions skip] workflows triggered on the push or pull_request events will be skipped.

I was bitten by that while working with Semantic Release and then resetting my deployment branches to the release commits. You can just reword the release commit and push (at least that's how I resolved it) in your deployment branch.

Comments

12

I found that my issue was described in the GitHub actions docs:

If you define a branch with the ! character, you must also define at least one branch without the ! character. If you only want to exclude branches, use branches-ignore instead.

Originally, I had this in my workflow (which didn't trigger the action):

on:
  push:
    branches:
      - "!main"

To fix it:

on:
  push:
    branches-ignore:
      - main

Comments

9

Be aware that you can't have nested folders. For example, .github/workflows/folder-1/my_workflow.yml will not be recognized by Github. In my case, I had to change it to .github/workflows/my_workflow.yml

Comments

6

For me, accidentally had named the folder .github/workspaces instead of .github/workflows.

Comments

5

If your commit is made by another action using the repository's GITHUB_TOKEN, the other workflow will not run.

You can fix this by creating a personal access token with write permission.

name: Push changes
    - uses: actions/checkout@v2
      with:
        token: ${{ secrets.PAT }}

1 Comment

This was my problem as well. Had to create a repo-scoped PAT and use that instead of the GITHUB_TOKEN when creating a PR from an Action so that the PR workflows would run. This problem is described in more detail at: github.com/peter-evans/create-pull-request/issues/…
5

If the repo is new, make sure to wait 5-10 minutes.

1 Comment

I had to wait for 60-90 minutes. (Standard workflows were triggered, but not the manually created ones).
4

In my case my workflow was not triggering because I was using double quotes inside a bash command which messed up the yml parsing.

You can check this on VSCode by seeing if the syntax highlighting looks off.

Comments

4

Suppose you have checked the branch and validated the actions, but the workflow isn't running. In that case, there's a high chance you need to enable read and write permissions from the relevant repository settings (top right corner) → Actions (left navigation bar) → General → Workflow permissions section.

GitHub repository settings enter image description here GitHub repository settings read and write permissions

Comments

4

Make sure to go to "Actions" tab and see if your run was errored. In my case, the check was pending on the PR view, because I changed a secret name in one workflow, but forgot to change in the calling workflow.

However, when I went to "Actions" tab I saw that my workflow was unable to run because the inputs don't match although required: true.

2 Comments

Hi @Moshisho, I did not quite understand your answer. Could you elaborate.
When you are viewing your repository in Github, you have a tab called "Actions". If your check or workflow is stuck or pending, you click that tab and you'll be able to see your workflow's output and look for errors etc...
3

In my case what I needed to run a workflow in pylint branch but it was not working until I added the same workflow in the main branch.In the main branch I added .github/workflows and then the yml file of the workflow which I wanted to run.

Once this was done i went to the pylint branch and then in the workflow I added pylint under the branches. After doing this workflow was getting triggered after every commit

name: Python Notebooks Linting
on:
  push:
    branches:
      - 'main'
      - 'pylint'

Comments

3

Just make sure your .yml file on push and pull_request is the right target. Look at your main branch first, is it master or main ?

on: 
  push:
    branches: [ main/master ]
  pull_request:
    branches: [ main/master ]

2 Comments

Why duplicate the accepted answer from two years before?
This will trigger the workflow on pushes to a branch named "main/master" as written.
2

You may need to merge your new workflow file into your Default branch for that repository. That was the only way I could get my workflow (for another branch) to appear on the GitHub Actions page. enter image description here

Comments

2

Please double check everything

Stupid mistake I made was naming a github folder with whitespace at the end, so on Github it was looking like .github /workflows(notice the space before the slash sign) instead of .github/workflows.

I have changed the folder name from github to github and pushed, and the workflow started running immediately.

Comments

2

The last possibility is that your workflow was automatically disabled because there was no update to the project in 90 days

I which case you need to go to the page of each specific workflow and click on the warning to reenable them (you will not see the warning in the All workflows page even if you only have one)

Comments

1

Today I had this issue, the same yaml file was working fine in other branches, but not in my new one(feature/somename). The solution was to rename the branch without using the slash ("/")

Comments

1

And another silly possibility to watch out for - I had something like

on:
  push:
    branches:
      - 'TTG-.*'
      - 'FRD-.*'

But it turns out that valid values for "branch expression" are globs, not regular expressions. So those periods in the branch names were being interpreted literally. I needed to change to

on:
  push:
    branches:
      - 'TTG-*'
      - 'FRD-*'

Comments

1

Does your branch name have any of these characters in it: + ? ! * ** ? and do you only run the workflow on pushes to that branch ?

Ours had these characters and so the workflow was not being triggered. Once we escaped out these characters by adding \ before them everything worked as expected.

Reference to GitHub documents here https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onpull_requestpull_request_targetbranchesbranches-ignore

Comments

1

this may sound a bit funny but sometimes the name of action also matter. For example in my case:

i changed a action named pre-releases.yml to pre_releases.yml

so my advice is keep name simple.

Comments

1

I also have a silly answer to this. I had all files/folders starting with "." in my gitignore, so the workflow file itself wasn't in my repo. Fixed it, then it worked! So, basically: Check that your workflow file isn't in your gitignore.

Comments

1

When I had this issue, the branch in my .yml (workflow file) file was not the branch I wanted to push to - as in git push origin "main" - right? For example, my "main" branch was where I was trying to push to whereas in my .yml file (workflow file) it had master in there. I changed it and everything worked perfectly!

Comments

1

In my case, it was the paths the issue. It had it like this:

on:
  push:
    branches:
      - develop
    paths:
      - '.github/workflows/deploy_dev.yml'

Once I removed the:

paths:
  - '.github/workflows/deploy_dev.yml'

It worked! Hope this will help someone!

Comments

0

In my case I was expecting workflow to be triggered on my bugfix branch, yet I forgot to specify it in the config.

name: CI
on:
  push:
    branches: [ master, develop, feature/** ]

Added bugfix/** and the trigger works.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.