I have a GitHub action with these steps:
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Git config
run: |
git config user.email "[email protected]"
git config user.name "my_username"
- name: Deploy
run: npm run deploy
env:
github_token: ${{ secrets.GITHUB_TOKEN }}
where the npm deploy script is
gh-pages -b master -d build
so I'm basically pushing the build from the branch develop to master.
The deploy script fails because it is not authenticating to git correctly. This is the error:
Run npm run deploy
> [email protected] deploy /home/runner/work/robertobatts.github.io/robertobatts.github.io
> gh-pages -b master -d build
fatal: could not read Username for 'https://github.com': No such device or address
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `gh-pages -b master -d build`
npm ERR! Exit status 1
The secrets.GITHUB_TOKEN should be created automatically by GitHub since I have set a workflow, so what am I doing wrong?