jeffreytse / jekyll-deploy-action

🪂 A Github Action to deploy the Jekyll site conveniently for GitHub Pages.
MIT License
339 stars 44 forks source link

gh-pages branch remains empty after push to master; pages build and deployment not triggered #62

Open luz-ojeda opened 1 year ago

luz-ojeda commented 1 year ago

Hello. If I understand correctly (correct me if I don´t please), if I commit to master I should expect two actions to be triggered, the custom one from the yml file and the pages build and deployment from github itself right? I have created the yml workflow file under .github/workflows/, set up the deployment to be from gh-pages branch but when I commit to master, gh-pages remains empty so I get a 404 when I go to my pages url

This is how the repo pages section is configured:

image

Thanks in advance

luz-ojeda commented 1 year ago

Fixed it. I had to configure Workflow permissions to "Read an write permissions" in the repo settings -> Actions -> General, to the bottom of the page. It was set to "Read repository contents and package permissions" by default.

image

jeffreytse commented 1 year ago

Hi @lezojeda

Thanks for your issue, and it's so glad to hear that you've solved the problem. And welcome to star this project for further update in the future.

Thanks & Regards

AlexStormwood commented 1 year ago

Can confirm, this was an issue for me and the change to permissions fixed this issue for me as well. It'd be worthwhile to put a note about this in the project's readme - it's the only hurdle that I had in getting this awesome action to work!

indie-rok commented 1 year ago

@lezojeda Made the trick! Thank you

davidalpert commented 1 year ago

if you do not want to change the default workflow permissions you can also set permissions for this workflow alone.

add something like this permissions block to your workflow:

...

jobs:
  build_and_deploy:
    runs-on: ubuntu-latest

    # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token
    permissions:
      contents: write # read to check out code / write enables push to the configured branch (e.g. gh-pages)
      pages: write

    steps:
      - uses: actions/checkout@v2

     ...