0

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?

1 Answer 1

1

I don't know precisely for your particular action, but usually, if the token is passed as an environment variable, it's in all-caps, like:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Or if passed in as a parameter, using with instead of env:

with:
  github_token: ${{ secrets.GITHUB_TOKEN }}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.