helaili / jekyll-action

A GitHub Action to publish Jekyll based content as a GitHub Pages site
MIT License
250 stars 120 forks source link

Fails with `error: src refspec does not match any` #30

Closed Philzen closed 4 years ago

Philzen commented 4 years ago

No matter what i try, my action runs always end up with:

error: src refspec ***@github.com/B-FfF/stadtwerk-mit-zukunft.git does not match any
error: failed to push some refs to 'https://'

What i've tried so far:

  1. as Github Pages were served from master branch before, the repository did not have a gh-pages branch yet. I manually created a gh-pages branch as an empty orphan branch containing only one commit.
  2. Initial plan was to deploy from development branch, so i switched back the script to only fire on master pushes as its done in the standard tutorial.

Both did not fix the issue, issue remains exactly the same. As i would like to avoid having to rollback my whole project to jekyll 3.x, help will be highly appreciated.

The action is as follows:

name: Jekyll to GitHub Pages CI

on:
  push:
    branches:
      - master

jobs:
  github-pages:
    runs-on: ubuntu-16.04
    steps:
      - name: πŸ›Ž Check out master
        uses: actions/checkout@v2

      # Use GitHub Actions' cache to shorten build times and decrease load on servers
      - name: πŸ“ Init gem cache
        uses: actions/cache@v1
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}

      - name: πŸ”¨ Build for Github-Pages
        uses: helaili/jekyll-action@2.0.1
        env:
          JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }}
limjh16 commented 4 years ago

Hey, did you include a JEKYLL_PAT secret in that repository? It is described here

Philzen commented 4 years ago

Hey, did you include a JEKYLL_PAT secret in that repository?

Yes, of course :wink: It has public_repo scope set as the tutorial advises (and only that).

limjh16 commented 4 years ago

maybe this has to do with #28... maybe you want to try with r4zzz4k/jekyll-action@3e01b0c for now to see whether it works?

helaili commented 4 years ago

Can you try to point at helaili/jekyll-action@master @Philzen ? Hopefully #28 fixed your problem.

Philzen commented 4 years ago

Thanks for your quick action.

Unfortunately it still fails with exactly the same message.

On the bright side, the exit code now is != 0, making the actions at least fail properly :wink:

limjh16 commented 4 years ago

Hmm, weird... the src refspec error appears before the git init message... could that be the issue? not sure what's causing it though edit: when I tried forking your repo and running it theres no error and when I went to change my JEKYLL_PAT secret to a wrong PAT the error message was different, so really not sure what's going on here, maybe you want to try to delete and re-push your repo? not sure if that will help though

helaili commented 4 years ago

I've added a test for the presence of the JEKYLL_PAT var and a debug message. Could you try another run, pointing at master with the secret ACTIONS_STEP_DEBUG set to true?

Philzen commented 4 years ago

grafik

There you go: https://github.com/B-FfF/stadtwerk-mit-zukunft/runs/672974991

helaili commented 4 years ago

Here's what I got:

##[debug]Pushing to https://***@github.com/helaili/jekyll-action.git

and this is what you have:

##[debug]Pushing to https:// ***@github.com/B-FfF/stadtwerk-mit-zukunft.git

It feels like your PAT starts with a space. Can you try removing and recreating the PAT?

Philzen commented 4 years ago

OMG that was it. :facepalm:

i can only apologize for taking up your valuable time, i am confused how that space slipped in when i created the JEKYLL_PAT secret... however it works now and that makes me happy :smile:

But at least we now know what to look for next time somebody has a similar problem. Or maybe it would be a useful improvement to your script to trim whitespace from JEKYLL_PAT?

oliverguhr commented 4 years ago

Haha, I made the same mistake too! The GitHub UI addes a whitespace between the green checkmark and you PAT πŸ™ˆ