GitHub Action workflow not running

Viewed 63643

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/github-pages-deploy-action@3.5.2
      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

15 Answers

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.

Hope this helps someone during this transition!

I ran into this issue and none of the answers were helping. It just wouldn't run and didn't make sense why. Until I found out there was a Github actions outage. Check https://www.githubstatus.com/

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

One more case, suppose if you already have workflow file inside project and if your paths set then the workflow will not RUN unless you make changes inside path folder. So if you make any changes to your workflow which kept outside of path won't trigger Action

on:
  push:
    branches:
     - master
    paths:
     - 'packages/container/**'
  • 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

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.

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.

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.

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]

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

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.

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

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'

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

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 ]
Related