Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action warnings cause an error to be returned #354

Closed
2 of 5 tasks
0xdeafcafe opened this issue Nov 2, 2021 · 4 comments
Closed
2 of 5 tasks

Action warnings cause an error to be returned #354

0xdeafcafe opened this issue Nov 2, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@0xdeafcafe
Copy link
Contributor

Description:
A warnings returned while the action is run will cause the workflow to error.

Action version:
v2.4.1

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:
Node 16.13.0 using yarn

Repro steps:
Workflow.yml

- name: Setup Node.js
  uses: actions/setup-node@v2.4.1
  with:
    node-version: '16'
    cache: 'yarn'
    cache-dependency-path: yarn.lock

The repository is also available here.

Expected behaviour:
Node gets setup correctly, and the rest of the workflow continues.

Actual behavior:
It fails due to a warning about the license field missing in the package.json. The exact same config seems to be working fine in this repo however, which is pretty bizarre.

Run actions/setup-node@v2.4.1
  with:
    node-version: 16
    cache: yarn
    cache-dependency-path: yarn.lock
    always-auth: false
    check-latest: false
    token: ***
  env:
    SHA: 08a818
Attempting to download 16...
Acquiring 16.13.0 - x64 from https://github.com/actions/node-versions/releases/download/16.13.0-1386584131/node-16.13.0-linux-x64.tar.gz
Extracting ...
/usr/bin/tar xz --strip 1 --warning=no-unknown-keyword -C /home/runner/work/_temp/25fbe9eb-9f33-4e66-a470-afcca2472a62 -f /home/runner/work/_temp/3bd3f952-6099-4d9e-9a97-db484619b083
Adding to the cache ...
Done
/usr/local/bin/yarn --version
1.22.17
/usr/local/bin/yarn cache dir
warning package.json: No license field
/home/runner/.cache/yarn/v6
Error: warning package.json: No license field
@0xdeafcafe 0xdeafcafe added bug Something isn't working needs triage labels Nov 2, 2021
@0xdeafcafe
Copy link
Contributor Author

This issue could be related to #352, however it was pointed out that may be due to mismatch of the caching logic and npm version.

@dmitry-shibanov
Copy link
Contributor

Hello @0xdeafcafe. Thank you for your report. It looks the issue comes from these lines, because warning writes to the error output, that is why error is not empty, but exit code is zero. I think we'll fix it from our side with something like this:

  if (exitCode && stderr) {
    throw new Error(stderr);
  }

@benjaminwood
Copy link

Agree that a warning shouldn't cause the workflow to error, but, as a stop-gap, you can silence the warning by adding "private": true to your package.json.

@dmitry-shibanov
Copy link
Contributor

Hello everyone. We released a new version to resolve a bug to fail action on the warning.
For now I'm going to close the issue. If you have any concerns feel free to ping us.

deining pushed a commit to deining/setup-node that referenced this issue Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants