jekyllt / jasper2

Full-featured Jekyll port of Ghost's default theme Casper v2 👻
https://jekyllt.github.io/jasper2/
MIT License
763 stars 659 forks source link

Error: Cannot publish on branch master #122

Closed mikelor closed 3 years ago

mikelor commented 3 years ago

First of all thanks for this template and what looks like keeping an active community going.

I'm new to Jekyll, so this could be a newbie error. I have since resolved it, but want to make sure I did it the "right" way, and perhaps provide an update to help others if it is correct.

I'm using GitHub Actions to post my changes. Whenever I committed code however, the build would fail on the helaili/jeckyll-action build step with “Error: Cannot publish on branch master”

To fix this I modified the jekyll_build.yml

    - uses: helaili/jekyll-action@v2
      with:
        token: ${{ secrets.GITHUB_TOKEN }}
        target_branch: 'gh-pages'

Adding the target_branch: 'gh-pages' fixed the error.

biomadeira commented 3 years ago

@mikelor thanks! I definitely missed it ;)

dhaksr commented 2 years ago

Hi, I am newbie and trying to use this awesome template. When I add a token "GITHUB_TOKEN" as secret, i get an error as "Secret names must not start with the GITHUB " error message. I was able to add my own secret by changing the name to something else. However the build is not successful. I cant find any error messages from the action flow too. So I am kind of stuck. If this doesnt work, I have to try with desktop. For now, I am trying to do everything on the web itself. I just noted that the secret that I have created is showing "Never Used" status in the settings page. So it looks like the workflow is not accessing my secret at all

biomadeira commented 2 years ago

@dhaksr GITHUB_TOKEN is added by the Actions so you shouldn't need to worry about that... anyway have a read at this - https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow

dhaksr commented 2 years ago

Sorry to bother.. I have tried to follow instructions as per Jasper2 readme. In that, I want to try the option 1 using github actions as I dont want to setup local repository. I have created a fresh code respository with just a readme file and I have created _yconfig.yml with single line having remote_theme: jekyllt/jasper2

I am able to see my changes in readme file getting published in the blog together with Jasper2 credits. However the beautiful image cards are not coming. :-(

Should I be doing something more?

I also tried to add a workflow with a copy of what is there as per this #122 issue. However, my workflow is not getting executed at all. I dont see the workflow actions console showing any execution. However my changes to readme file are getting reflected in the webpage. So, I assume its executing default Jekyll build and not my build. However its referring to your theme as the credits is reflecting.

I have copied my web page output for your reference. The page link is also provided. Thanks for reading thru so long. Appreciate your work

https://dhaksr.github.io/bloggweb/ (this is just the readme and _yconfig file) https://dhaksr.github.io/testweb/ ( this is with readme, _yconfig and workflow file)

--- copy of my web page ---

image

mikelor commented 2 years ago

@dhaksr, you'll want to fork the entire jekyllt/jasper2 respository to your account. It looks like you've created your repo with only a few files. Take a look at https://github.com/mikelor/mikelor.github.io

There are also two branches master and gh-pages. You make changes to the gh-pages branch

dhaksr commented 2 years ago

I will try that. But if my workflow action works correctly, should it not build gh-pages in my repository? If my understanding is incorrect, can the readme of jasper2 be updated to reflect this fork step to be done? Initially i thought its the privelege escalation or lack of access to my repository.. but now I think my workflow is not triggered at all.

Looks like few others are also facing some issues in setup (i found this https://dev.to/bauripalash/comment/528o). Its not my exact situation, i am trying to do on github itself - most others are trying with local copy.

mikelor commented 2 years ago

Ah, I see, I haven't tried the link you provided, but that looks like it should work. When I look at your two sample repos, you haven't committed everything back, you only have a couple of files and only a "master" branch.

The downside of this approach, doing a git clone, and then creating a new repo is that you lose touch with the jekyllt/jasper2 so any new changes will be difficult to incorporate. I won't have time to investigate further until the weekend, good luck!