I have a simple Node JS application built in the build
directory using yarn
and trying to deploy on GitHub Pages using GitHub Actions using crazy-max/ghaction-github-pages@v2
actinon in the simplest form:
- name: Deploy
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: master
build_dir: build
env:
$GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
(Note I deploy to master
because the repository name is equal to the <<username>>.github.io
)
To my surprise, it fails on the following error:
Error: You have to provide a GITHUB_TOKEN or GH_PAT
The whole message is not helpful as long as I know the GITHUB_TOKEN
is automatically generated with each build.
The repository has the following settings under Action:
- Actions permissions: Allow all actions
- Fork pull request workflows from outside collaborators: Require approval for first-time contributors
- Workflow permissions: Read and write permissions
The whole token and permissions management in GitHub is overkill for simple projects and the documentation lacks sample settings and the reader only goes down the rabbit hole.
How to get this run?
CodePudding user response:
Based on the documentation I'm reading, it looks like you need to remove the leading $
from your environment variable name you are setting
Like this:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Documenation: