GitHub Action workflow not running

Github Actions

Github Actions Problem Overview


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

Github Actions Solutions


Solution 1 - Github Actions

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!

Solution 2 - Github Actions

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/

Solution 3 - Github Actions

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

Solution 4 - Github Actions

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/**'

Solution 5 - Github Actions

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.

Solution 6 - Github Actions

  • 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

Solution 7 - Github Actions

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.

Solution 8 - Github Actions

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.

Solution 9 - Github Actions

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]

Solution 10 - Github Actions

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKieranLewinView Question on Stackoverflow
Solution 1 - Github Actionsfr_andresView Answer on Stackoverflow
Solution 2 - Github ActionsFuriousDView Answer on Stackoverflow
Solution 3 - Github ActionsKieranLewinView Answer on Stackoverflow
Solution 4 - Github ActionssachinkondanaView Answer on Stackoverflow
Solution 5 - Github Actionsanmol gomraView Answer on Stackoverflow
Solution 6 - Github ActionsJehad NasserView Answer on Stackoverflow
Solution 7 - Github ActionsA248View Answer on Stackoverflow
Solution 8 - Github ActionsinfinityView Answer on Stackoverflow
Solution 9 - Github Actionstjg184View Answer on Stackoverflow
Solution 10 - Github ActionsdvdblkView Answer on Stackoverflow