Creating a $HOME/.netrc with an action

Hello! I’ve created an action that creates a .netrc file for curl to use (https://github.com/onomondo/github-auth-netrc-javascript-action) to authenticate with github when we run npm install as we have a package defined as a private repo.

The thing is it works if I do it manually in a step:

name: CI

on: [push]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: npm install, build and test
      run: |
        echo "machine github.com login ${{ secrets.GITHUB_AUTH_TOKEN }} password x-oauth-basic" > $HOME/.netrc
        npm install
        npx vue-cli-service lint

Here’s a configuration using the action that does not work:

on: [push]

jobs:
  hello_world_job:
    runs-on: ubuntu-latest
    name: Install private npm package hosted on github
    steps:
    - uses: actions/checkout@v1
    - uses: onomondo/github-auth-netrc-javascript-action@master
      with:
        github-auth-token: ${{ secrets.GITHUB_AUTH_KEY }}
    - name: npm install, build and test
      run: |
        npm install

I’ve tried listing the home directory etc both in the action and in the run steps and the file is listed in the output.

Any clues whether this is a limitation of actions and I’ll have to continue doing it inline or?

@dinoshauer In the example you have below you have two different secret names.  Is that intentional?

1 Like

Wow. Thanks for the fresh set of eyes!