helaili/jekyll-action

Replace secrets.JEKYLL_PAT with secrets.GITHUB_TOKEN to prevent build failure?

dietercastel opened this issue · 8 comments

I stumbled upon this issue in one of my on repositories and I think this might apply to this repository as well. I don't know when they (Jekyll?) changed the name from secrets.JEKYLL_PAT to secrets.GITHUB_TOKEN but my Jekyll builds started failing because of that. Thought I'd let you know. :-)

Official docs reflecting the change:
https://jekyllrb.com/docs/continuous-integration/github-actions/#setting-up-the-action
Some tweets of mine about the issue (which probably affects a couple hundred repo's still):
https://twitter.com/DieterCastel/status/1495426423556816897

Cheers! :-)

Thank you very much, your tweet and this issue saved me when I noticed that suddenly our deployment was failing, although the CI job ran through without any errors

Nobody renamed anything here. secrets.JEKYLL_PAT would be the name of a custom secret you would create to provide a personal access token, while secrets.GITHUB_TOKEN is the the token provided out of the box by GitHub Actions. Depending on what you try to achieve, the latter could be sufficient otherwise you will need to create the former.

Having said that, it is true that I have replaced the JEKYLL_PAT environment variable with a token parameter, but it is only a deprecation and I believe it should still work. Happy to look at some logs if it's not the case.

Here is an example from a recent run:
https://github.com/JabRef/www.jabref.org/actions/runs/1909065764


Run helaili/jekyll-action@v2
/usr/bin/docker run --name db2d767a636d6114e4aceb07e230af1829720_4b5005 --label 7db2d7 --workdir /github/workspace --rm -e npm_config_cache -e JEKYLL_PAT -e INPUT_TOKEN -e INPUT_JEKYLL_ENV -e INPUT_JEKYLL_SRC -e INPUT_JEKYLL_BUILD_OPTIONS -e INPUT_GEM_SRC -e INPUT_TARGET_BRANCH -e INPUT_TARGET_PATH -e INPUT_BUILD_ONLY -e INPUT_KEEP_HISTORY -e INPUT_PRE_BUILD_COMMANDS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/www.jabref.org/www.jabref.org":"/github/workspace" 7db2d7:67a636d6114e4aceb07e230af1829720
Starting the Jekyll Action
Warning: The JEKYLL_PAT environment variable is deprecated. Please use the token parameter
Warning: Cannot get GitHub Pages source branch via API.
Warning: {
  "message": "Bad credentials",
  "documentation_url": "https://docs.github.com/rest"
}

Most likely you could just remove the env variable and/or token parameter altogether and rely on the default behaviour. In your case the secret was either missing or not having enough privileges.

It was working 9 days before and all the time. Nothing has changed.
I switched to the setup the first post suggested and it works again

Nobody renamed anything here. secrets.JEKYLL_PAT would be the name of a custom secret you would create to provide a personal access token, while secrets.GITHUB_TOKEN is the the token provided out of the box by GitHub Actions. Depending on what you try to achieve, the latter could be sufficient otherwise you will need to create the former.

Having said that, it is true that I have replaced the JEKYLL_PAT environment variable with a token parameter, but it is only a deprecation and I believe it should still work. Happy to look at some logs if it's not the case.

I never said someone renamed it. It's the github API/side that did the renaming resulting in broken builds (as per one of my own projects). I'm really not (git) blaming anyone. :-) Just trying to help out.

Here is an example from a recent run: https://github.com/JabRef/www.jabref.org/actions/runs/1909065764


Run helaili/jekyll-action@v2
/usr/bin/docker run --name db2d767a636d6114e4aceb07e230af1829720_4b5005 --label 7db2d7 --workdir /github/workspace --rm -e npm_config_cache -e JEKYLL_PAT -e INPUT_TOKEN -e INPUT_JEKYLL_ENV -e INPUT_JEKYLL_SRC -e INPUT_JEKYLL_BUILD_OPTIONS -e INPUT_GEM_SRC -e INPUT_TARGET_BRANCH -e INPUT_TARGET_PATH -e INPUT_BUILD_ONLY -e INPUT_KEEP_HISTORY -e INPUT_PRE_BUILD_COMMANDS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/www.jabref.org/www.jabref.org":"/github/workspace" 7db2d7:67a636d6114e4aceb07e230af1829720
Starting the Jekyll Action
Warning: The JEKYLL_PAT environment variable is deprecated. Please use the token parameter
Warning: Cannot get GitHub Pages source branch via API.
Warning: {
  "message": "Bad credentials",
  "documentation_url": "https://docs.github.com/rest"
}

Yeah, so that shows. Just replacing JEKYLL_PAT with GITHUB_TOKEN should fix it AFAIK.

It was working 9 days before and all the time. Nothing has changed. I switched to the setup the first post suggested and it works again

:-) That was exactly what I hoped for. My pleasure really!