npm-publish icon indicating copy to clipboard operation
npm-publish copied to clipboard

Error: Input required and not supplied: token

Open lastdoctor opened this issue 3 years ago • 6 comments

Hi, I have problem npm-publish.yml `on: push

jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 with: node-version: 10 - run: npm install - run: npm test - uses: JS-DevTools/npm-publish@v1 with: token: ${{ secrets.NPM_TOKEN }}`

and Here I have problem Run JS-DevTools/npm-publish@v1 with: registry: https://registry.npmjs.org/ package: package.json tag: latest dry-run: false check-version: true Error: Error: Input required and not supplied: token at Object.getInput (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/node_modules/@actions/core/lib/core.js:94:1) at main (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:17:14) at Object.48 (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:74:1) at __webpack_require__ (/webpack/bootstrap:21:1) at startup (/webpack/bootstrap:40:1) at /webpack/bootstrap:44:1 at Object.<anonymous> (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/dist/index.js:50:10) at Module._compile (internal/modules/cjs/loader.js:959:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10) at Module.load (internal/modules/cjs/loader.js:815:32)

lastdoctor avatar Jan 31 '21 18:01 lastdoctor

I'm receiving the same error.

Failed GitHub Action for reference: https://github.com/trivikr/test-postinstall-node-version-check/actions/runs/727995782

Error:

Error: Error: Input required and not supplied: token
    at Object.getInput (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/node_modules/@actions/core/lib/core.js:94:1)
    at main (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:17:14)
    at Object.48 (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/src/action/index.ts:74:1)
    at __webpack_require__ (/webpack/bootstrap:21:1)
    at startup (/webpack/bootstrap:40:1)
    at /webpack/bootstrap:44:1
    at Object.<anonymous> (/home/runner/work/_actions/JS-DevTools/npm-publish/v1/dist/index.js:50:10)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)

Configuration for reference:

name: push

on:
  push:
    branches: [main]

jobs:
  publish:
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v2
      - uses: JS-DevTools/npm-publish@v1
        env:
          token: ${{ secrets.NPM_AUTH_TOKEN }}

I verified that NPM_AUTH_TOKEN GitHub secret is present, as the same secret was successfully used by https://github.com/marketplace/actions/automated-releases-for-npm-packages prior to testing npm-publish

trivikr avatar Apr 08 '21 02:04 trivikr

I'm having this same issue as well ^

ayush-goyal avatar Apr 13 '21 06:04 ayush-goyal

same error with this configuration

name: npm-publish
on: "workflow_dispatch"
jobs:
  npm-publish:
    name: npm-publish
    runs-on: ubuntu-latest
    steps:
    - name: Checkout repository
      uses: actions/checkout@master
    - name: Set up Node.js
      uses: actions/setup-node@master
      with:
        node-version: 14.0.0
    - id: publish
      uses: JS-DevTools/npm-publish@v1
      with:
        token: ${{ secrets.NPM_TOKEN }}

The Error Log: https://github.com/Nurutomo/xteam-api/runs/2812373560?check_suite_focus=true

Nurutomo avatar Jun 13 '21 05:06 Nurutomo

The workaround I found to work is to run env as a step before this action. Like so:

    - name: List Github Actions
       run: env
    - uses: JS-DevTools/npm-publish@v1
      with:
        token: ${{ secrets.NPM_TOKEN }}

It seems there's some race condition where the action tries to read process.env, but the variables were not yet set up? 🤔 It sounds weird this explanation, but it's the closest thing I can think about

UPDATE: I was wrong, this didn't actually workaround the issue but strange given that I tried a couple of times to be sure it wasn't a false positive. 🤔

thegiantbeast avatar Mar 15 '22 11:03 thegiantbeast

@JamesMessinger any thoughts on this one? 🙇

thegiantbeast avatar Mar 15 '22 11:03 thegiantbeast

I ran into this issue as well, my problem was not setting the environment key, that's why the publish step didn't have access to {{ secrets.NPM_TOKEN }}. More info in the github action docs here 😄

OskarDamkjaer avatar Apr 04 '22 07:04 OskarDamkjaer

Hi all, these all look like various misconfiguration issues. I'm going to close this issue since links to various action run logs posted have expired so reproduction would be overly difficult. If anyone is still experiencing issues, please feel free to open a new issue!

If you're interested in seeing a working configuration for this action, you can take a look at: https://github.com/viamrobotics/prime/blob/main/.github/workflows/publish.yml

mcous avatar Apr 07 '23 16:04 mcous