Jekyll Github Action stopped working and now fails with error message: "Cannot publish on branch master"

Viewed 364

I have a blog deployed on Github Pages. I use Jekyll Github Action and everything worked fine until my last deployment some 3 months ago. I created a new entry and now I get an error: "Cannot publish on branch master".

This is my Workflow:

name: Deploy

on:
  push:
    branches: master

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: helaili/jekyll-action@2.0.1
        env:
          JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }}
          JEKYLL_ENV: production

This is the configuration of Github Pages, we haven't changed anything:

enter image description here

We used to push to master so that the action would generate the site on gh-pages but it stopped working. I know that the action is now on version 2.1.0 but I would expect my configuration to still be working.

1 Answers

Ok, I don't know why it worked before because this is an org.github.io type of repo, and looking at the source code of the action it used this information to decide the branch (master or gh-pages). Unfortunately the logs of the previous builds are not available to trace the problem.

To make it work I had to upgrade to 2.0.5 and use the target_branch input:

name: Deploy

on:
  push:
    branches: master

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: helaili/jekyll-action@2.0.5
        with:
          target_branch: 'gh-pages'
        env:
          JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }}
          JEKYLL_ENV: production
Related