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

Respect package.json's engines.node field when used as a node-version-file #485

Merged
merged 4 commits into from
Jul 21, 2022

Conversation

mannie-exe
Copy link
Contributor

@mannie-exe mannie-exe commented May 6, 2022

Description:
Allow passing package.json files as node-version-file. I'm not 100% sure about how this affects nested packages or workspaces, and any input on the matter would be lovely! I did my best at writing a new test, but my knowledge about Jest is very limited — and any review for that would be appreciated as well.

I'm checking if the file contents of node-version-file are parseable as JSON, and if the engines.node key exists — otherwise the file is treated as it was in the past. If a name-based solution would be better (check if the node-version-file is named package.json explicitly in the installer file), then let me know and I'll make those changes as well.

Thanks for your work!

Related issue:
Adds support for #467

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

@mannie-exe mannie-exe requested a review from a team May 6, 2022 16:37
@mannie-exe mannie-exe changed the title Feat/respect package json Respect package.json's engines.node field when used as a node-version-file May 6, 2022
@e-korolevskii
Copy link
Contributor

Hi @schmannie,

Unfortunately, one of the tests fails: "setup-node › node-version-file flag › reads package.json as node-version-file if provided" gives an error when run on Windows. Hopefully you can figure this out.

Have a nice day!

@mannie-exe
Copy link
Contributor Author

Hey @e-korolevskii !

I can't see the logs from the test any more (at least not on mobile, while I'm away from my computer).

My guess is that the windows test failed because of one of two reasons: path-related issues or a line-ending related issue. I'm guessing it's the line-endings, because:

I simply set the expected arguments in the test to be the raw contents of the JSON file. If a Windows machine with Git set to checkout Windows-styled line-endings is used to run the tests, the newline character sequence will be different when compared to the raw string I've set in the test.

I considered just reading the package.json directly in the test to compare against, but I wasn't sure if that was a useful way to test.


How would you suggest I rewrite this test? Since the version file parsing function accepts the file contents directly, I figured just reading the contents of package.json in the test would be a passing solution, but maybe a dumb one. Would it be better to split the functionality or better to just read the package.json in the test as well?

@e-korolevskii
Copy link
Contributor

Hello, @schmannie

As you suggested, tests fails because of line-ending symbols. The one of the easiest way to solve that - replace unwanted "\r" characters. I think, after "readFileSync" (line 91) you could just call the replace method to avoid this problem.
Could you please implement that?

@mannie-exe
Copy link
Contributor Author

@e-korolevskii sorry it took so long! I moved recently, and somehow it ended my SSD's life lol. A week later and I've finally been able to make the very small change you wanted me to make.

The tests are passing on my end. Let me know if there's anything else you'd like me to do.

@dmitry-shibanov
Copy link
Contributor

Hello @schmannie. Could you please sync with the main branch ?

@mannie-exe mannie-exe force-pushed the feat/respect-package-json branch from 197515f to 62bd11a Compare May 16, 2022 07:35
@mannie-exe
Copy link
Contributor Author

@dmitry-shibanov all done!

@dmitry-shibanov
Copy link
Contributor

@schmannie Could you please run the npm run format command ?

@mannie-exe
Copy link
Contributor Author

mannie-exe commented May 16, 2022

Hey! I already noticed I forgot to run that. I was just about to submit the last commit — and my whole house's power went out because somebody hit a nearby pole lol. It's gonna take another couple hours... See ya' then hahaha.


EDIT: I've made (hopefully) the final push.
Thanks!


EDIT: How come the e2e tests failed this time?


EDIT: I see just one particular e2e test (node 12 on macOS) failed due to a timeout. Can I get a rerun, or is it safe to merge?

@mannie-exe
Copy link
Contributor Author

@e-korolevskii @dmitry-shibanov

The tests reran and completed successfully! Pinging one last time, for a final review and merge request.

@jef jef mentioned this pull request Jun 29, 2022
2 tasks
@sztadii
Copy link

sztadii commented Jul 20, 2022

Thanks, @schmannie I was looking today for this functionality :) @dmitry-shibanov @marko-zivic-93 can we merge it?

@sztadii
Copy link

sztadii commented Jul 20, 2022

Ohh, right. Merge conflicts :(

@dmitry-shibanov
Copy link
Contributor

Hello @schmannie. Sorry for the late response. Could you please resolve merge conflicts ?

@mannie-exe
Copy link
Contributor Author

mannie-exe commented Jul 20, 2022

Hello @schmannie. Sorry for the late response. Could you please resolve merge conflicts ?

Hey there! I'm really sorry, but I haven't had the moment to fix said conflicts. Porting my solution over directly didn't work as expected.

I haven't had the moment to look through the couple months of commits, and the changes they introduced. I noticed there's a different format to how node version files are read? (node[v|version]x.y.z-platform or something) Is this a standard I don't know about? Previously, I was simply returning the engines.node field/the semver in the package.json (if present) — is something else required?

I'll push my changes so far, and we can look at the failing tests together.

EDIT: Just to be clear, I'm not sure of what the issues are or how to read these tests. These changes should not be merged until the issues are fixed, but I would appreciate any help/suggestions.

@mannie-exe mannie-exe force-pushed the feat/respect-package-json branch from 8815e5a to 3bf06e2 Compare July 20, 2022 11:53
@brcrista
Copy link
Contributor

These changes should not be merged until the issues are fixed, but I would appreciate any help/suggestions.

@schmannie looks like tests are passing and there are no more merge conflicts. Anything left before we can merge?

@sztadii
Copy link

sztadii commented Jul 21, 2022

Actually, I thought this behavior should be a default one, cause engines is a part of npm.
So instead of

uses: actions/setup-node@v3
with:
  node-version-file: 'package.json'

we should have

uses: actions/setup-node@v3

@mannie-exe
Copy link
Contributor Author

These changes should not be merged until the issues are fixed, but I would appreciate any help/suggestions.

@schmannie looks like tests are passing and there are no more merge conflicts. Anything left before we can merge?

I guess not! I was getting a ton of failing tests in my local repo, but I guess I'm glad they're not present. I'm okay with the merge as long as everything looks fine on your end.

Actually, I thought this behavior should be a default one, cause engines is a part of npm.
So instead of

uses: actions/setup-node@v3
with:
  node-version-file: 'package.json'

we should have

uses: actions/setup-node@v3

I think that decision is slightly above my pay grade, but I do sort of agree with this. Either way, changing default behavior should probably be a separate issue.

Thanks everyone!

@brcrista brcrista mentioned this pull request Jul 21, 2022
@brcrista
Copy link
Contributor

Agreed, let's merge this on its own before considering changes to the default behavior.

@brcrista
Copy link
Contributor

Thanks @schmannie !

@brcrista brcrista merged commit 2a814b5 into actions:main Jul 21, 2022
@sztadii
Copy link

sztadii commented Jul 29, 2022

@brcrista It was merged 8 days ago and still it is not released :(

@brcrista
Copy link
Contributor

brcrista commented Aug 1, 2022

You can reference the SHA of the merge commit directly if you want to use it before the next release comes out.

@sztadii
Copy link

sztadii commented Aug 3, 2022

@brcrista I am not sure but something went wrong.
When I was using the .nvmrc file then action without any issue downloaded the proper node version.
Please look here to see it working

When I am trying to use the latest version of our then it can not fetch a proper node version.

Any idea what can be wrong?

@vsafonkin
Copy link

vsafonkin commented Aug 3, 2022

@sztadii, looks like this regular expression doesn't work correctly with package.json file and the first brace in the file is matched by the expression.

Probably we should skip this regexp check if we use package.json.

@mannie-exe
Copy link
Contributor Author

@sztadii, looks like this regular expression doesn't work correctly with package.json file and the first brace in the file is matched by the expression.

Probably we should skip this regexp check if we use package.json.

Thank you very much for #553!

thewilkybarkid added a commit to PREreview/prereview.org that referenced this pull request Sep 29, 2022
The 'setup-node' action has added support for reading the Node version from the package.json file.

Refs 55f834e, actions/setup-node#485
kodiakhq bot added a commit to 3x071c/lsg-musin that referenced this pull request Oct 9, 2022
This PR contains the following updates:



Package
Change
Age
Adoption
Passing
Confidence
Type
Update




@astrojs/partytown (source)
1.0.0 -> 1.0.1




dependencies
patch


@picocss/pico (source)
1.5.5 -> 1.5.6




dependencies
patch


@types/node (source)
18.7.23 -> 18.8.3




devDependencies
minor


actions/checkout
v3.0.0 -> v3.1.0




action
minor


actions/setup-node
v3.0.0 -> v3.5.0




action
minor


actions/stale
v6.0.0 -> v6.0.1




action
patch


astro (source)
1.3.1 -> 1.4.6




dependencies
minor


astro-netlify-cms
0.2.2 -> 0.2.3




dependencies
patch


cspell (source)
6.10.1 -> 6.12.0




devDependencies
minor


eslint (source)
8.24.0 -> 8.25.0




devDependencies
minor


eslint-plugin-astro (source)
0.19.0 -> 0.20.0




devDependencies
minor


nick-fields/retry
v2.6.0 -> v2.8.1




action
minor


postcss (source)
8.4.16 -> 8.4.17




devDependencies
patch


prettier-plugin-astro
0.5.4 -> 0.5.5




devDependencies
patch


prettier-plugin-prisma
4.2.0 -> 4.4.0




devDependencies
minor


vite (source)
3.1.4 -> 3.1.6




devDependencies
patch




Release Notes

withastro/astro (@​astrojs/partytown)
v1.0.1
Compare Source
Patch Changes

#​4989 50a397c4b Thanks @​that-joao! - Update @​builder.io/partytown dependency



picocss/pico
v1.5.6
Compare Source
Features

Adds the ability to compile Pico with a root element other than body (E.g. #__next, #___gatsby, #root), by @​ja1den
Define your your CSS selector in scss/_variables.scss > $semantic-root-element
#​224 #​13 #​222

Fixes

aria-invalid for dates input, by @​rbf
#​242 #​243

Documentation

Improves Customization and Class-less pages
#​245

Full changelog
A huge thank you to all the contributors ❤️


actions/checkout
v3.1.0
Compare Source

Use @​actions/core saveState and getState
Add github-server-url input

v3.0.2
Compare Source

Add input set-safe-directory

v3.0.1
Compare Source

Fixed an issue where checkout failed to run in container jobs due to the new git setting safe.directory
Bumped various npm package versions



actions/setup-node
v3.5.0
Compare Source
In scope of this release we add support for engines.node. The action will be able to grab the version form package.json#engines.node. actions/setup-node#485. Moreover, we added support for Volta
Besides, we updated @​actions/core to 1.9.1 and @​actions/cache to 3.0.4
v3.4.1
Compare Source
In scope of this release we fixed bugs related to the pnpm 7.5.1 output issue from pnpm store path actions/setup-node#545. Moreover we fixed the issue with falling on node-version output actions/setup-node#540.
v3.4.0
Compare Source
In scope of this release we updated actions/cache package as the new version contains fixes for caching error handling. Moreover, we added support for asdf format as Node.js version file actions/setup-node#373. Besides, we introduced new output node-version and added npm-shrinkwrap.json to dependency file patterns: actions/setup-node#439
v3.3.0
Compare Source
In scope of this release we added support for lts/-n aliases, improve logic for current, latest and node aliases to handle them from toolcache, update ncc package.
Support of lts/-n aliases

Related pull request: actions/setup-node#481
Related issue: actions/setup-node#26

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
  with:
    node-version: lts/-1
- run: npm ci
- run: npm test
Minor improvements

Update zeit/ncc to vercel/ncc: actions/setup-node#476
Get latest version from cache if exists: actions/setup-node#496

v3.2.0
Compare Source
In scope of this release we added new aliases to install the latest Node.js version. actions/setup-node#483
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
  with:
    node-version: current
- run: npm ci
- run: npm test
v3.1.1
Compare Source
In scope of this release we updated actions/cache package as the new version contains fixes related to GHES 3.5 (actions/setup-node#460)
v3.1.0
Compare Source
In scope of this release we added support for caching from GHES 3.5 and fixed download issue for files > 2GB during restore. Besides, we updated actions/cache dependency to 2.0.0 version.


actions/stale
v6.0.1
Compare Source
Update @​actions/core to 1.10.0 #​839
Full Changelog: actions/[email protected]


withastro/astro (astro)
v1.4.6
Compare Source
Patch Changes

#​5013 ffbe4e71e Thanks @​matthewp! - Fixes getViteConfig from astro/config

v1.4.5
Compare Source
Patch Changes


#​4981 1f890b336 Thanks @​matthewp! - Ensure dynamic tags have their slot instructions yielded


#​4886 61d26f335 Thanks @​yuhang-dong! - Fix: import.meta.env.BASE_URL will be '/' in client loaded component on dev mode


#​4973 c733d4fb8 Thanks @​bluwy! - Support Astro.slots.render for mdx


#​4918 a6bb2694b Thanks @​bluwy! - Refactor hydration path handling


#​4977 4f73b98ae Thanks @​tony-sull! - Fixes a bug that logged route cache warnings in astro dev


#​4887 37cb2fc02 Thanks @​Calvin-LL! - fix object styles not escaped


#​4990 8f9791d84 Thanks @​matthewp! - Upgrade Astro compiler to 0.26.0


v1.4.4
Compare Source
Patch Changes


#​4967 e6a881081 Thanks @​matthewp! - Final perf fix from 1.3.0 regression
A regression in rendering perf happened in 1.3.0. This is the final fix for the underlying issue.


v1.4.3
Compare Source
Patch Changes


#​4956 ee8dd424f Thanks @​matthewp! - Fix perf regression in SSR


#​4952 5bcd76e3a Thanks @​bluwy! - Refactor ViteConfigWithSSR type


v1.4.2
Compare Source
Patch Changes


#​4932 9898088c0 Thanks @​matthewp! - Prevent hydration mismatch in streaming SSR


#​4939 cf2bba1e4 Thanks @​natemoo-re! - Fix MDX error handling, preventing a memory leak


v1.4.1
Compare Source
Patch Changes

#​4928 7690849a8 Thanks @​Princesseuh! - Fix module definition of Markdown and MDX files not being available outside Astro files

v1.4.0
Compare Source
Minor Changes


#​4907 01c1aaa00 Thanks @​matthewp! - Order Astro styles last, to override imported styles
This fixes CSS ordering so that imported styles are placed higher than page/component level styles. This means that if you do:




delucis/astro-netlify-cms
v0.2.3
Compare Source
Patch Changes

#​23 26243d5 Thanks @​codelastnight! - remove node join() from vite-plugin-admin-dashboard to allow windows to run dev



streetsidesoftware/cspell
v6.12.0
Compare Source
Features

Use cspell-dictionary Module (#​3686) (6441f4b)

6.11.1 (2022-09-30)
Bug Fixes

Fix export of SpellingDictionaryCollection (#​3683) (7665cdb)

v6.11.1
Compare Source
Bug Fixes

Fix export of SpellingDictionaryCollection (#​3683) (7665cdb)

v6.11.0
Compare Source
Note: Version bump only for package cspell-monorepo
6.10.1 (2022-09-20)
Note: Version bump only for package cspell-monorepo


eslint/eslint
v8.25.0
Compare Source
Features

173e820 feat: Pass --max-warnings value to formatters (#​16348) (Brandon Mills)
6964cb1 feat: remove support for ignore files in FlatESLint (#​16355) (Milos Djermanovic)
1cc4b3a feat: id-length counts graphemes instead of code units (#​16321) (Sosuke Suzuki)

Documentation

90c6028 docs: Conflicting fixes (#​16366) (Ben Perlmutter)
5a3fe70 docs: Add VS to integrations page (#​16381) (Maria José Solano)
49bd1e5 docs: remove unused link definitions (#​16376) (Nick Schonning)
3bd380d docs: typo cleanups for docs (#​16374) (Nick Schonning)
b3a0837 docs: remove duplicate words (#​16378) (Nick Schonning)
a682562 docs: add BigInt to new-cap docs (#​16362) (Sosuke Suzuki)
f6d57fb docs: Update docs README (#​16352) (Ben Perlmutter)
7214347 docs: fix logical-assignment-operators option typo (#​16346) (Jonathan Wilsson)

Chores

1f78594 chore: upgrade @​eslint/eslintrc@​1.3.3 (#​16397) (Milos Djermanovic)
8476a9b chore: Remove CODEOWNERS (#​16375) (Nick Schonning)
720ff75 chore: use "ci" for Dependabot commit message (#​16377) (Nick Schonning)
42f5479 chore: bump actions/stale from 5 to 6 (#​16350) (dependabot[bot])
e5e9e27 chore: remove jsdoc dev dependency (#​16344) (Milos Djermanovic)



ota-meshi/eslint-plugin-astro
v0.20.0
Compare Source
Minor Changes

#​116 9c481f8 Thanks @​renovate! - update dependency astro-eslint-parser to ^0.7.0



nick-fields/retry
v2.8.1
Compare Source
Refactor to make testing easier
v2.8.0
Compare Source
Use spawn rather than exec to support much larger outputs

Should resolve #​84  and #​76

v2.7.1
Compare Source
This release contains mostly dependency updates. There are a few very minor changes to runtime code based on development quality of life improvements from newly configured linting and styling.
v2.7.0
Compare Source
Features

retry only on specific exit code (#​58) (f227091)

Misc

Various dependabot updates



postcss/postcss
v8.4.17
Compare Source

Fixed Node.before() unexpected behavior (by Romain Menke).
Added TOC to docs (by Mikhail Dedov).



withastro/prettier-plugin-astro
v0.5.5
Compare Source
Patch Changes

fe68b94: Fix missing newline after attributes on inline elements when using singleAttributePerLine
96e2b28: Fix expressions not hugging the end of the tag in cases where they should
4e6fde8: Fix newlines being added to style tags even if they were empty



umidbekk/prettier-plugin-prisma
v4.4.0
Compare Source

feat: Bump @prisma/prisma-fmt-wasm to 4.4.0.  7e2fd9a

v4.3.0
Compare Source

feat: Bump @prisma/prisma-fmt-wasm to 4.3.0.  71f66fe
chore: Bump dependencies.  d976203



vitejs/vite
v3.1.6
Compare Source
Please refer to CHANGELOG.md for details.
v3.1.5
Compare Source
Please refer to CHANGELOG.md for details.


Configuration
📅 Schedule: Branch creation - "before 2am" in timezone Europe/Berlin, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


 If you want to rebase/retry this PR, click this checkbox.


This PR has been generated by Mend Renovate. View repository job log here.
fuxingloh referenced this pull request in DeFiCh/metachain Oct 12, 2022
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/setup-node](https://github.com/actions/setup-node) | action
| minor | `v3.4.1` -> `v3.5.0` |

---

### Release Notes

<details>
<summary>actions/setup-node</summary>

###
[`v3.5.0`](https://github.com/actions/setup-node/releases/tag/v3.5.0)

[Compare
Source](https://github.com/actions/setup-node/compare/v3.4.1...v3.5.0)

In scope of this release we add support for engines.node. The action
will be able to grab the version form package.json#engines.node.
[https://github.com/actions/setup-node/pull/485](https://github.com/actions/setup-node/pull/485).
Moreover, we [added support for
Volta](https://github.com/actions/setup-node/pull/532)

Besides, we updated [@&#8203;actions/core to
1.9.1](https://github.com/actions/setup-node/pull/574) and
[@&#8203;actions/cache to
3.0.4](https://github.com/actions/setup-node/pull/573)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click
this checkbox.

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/DeFiCh/metachain).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMTYuMCIsInVwZGF0ZWRJblZlciI6IjMyLjIxNi4wIn0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
fuxingloh referenced this pull request in levaintech/sticky Oct 18, 2022
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/setup-node](https://github.com/actions/setup-node) | action
| minor | `v3.4.1` -> `v3.5.1` |

---

### Release Notes

<details>
<summary>actions/setup-node</summary>

###
[`v3.5.1`](https://github.com/actions/setup-node/releases/tag/v3.5.1)

[Compare
Source](https://github.com/actions/setup-node/compare/v3.5.0...v3.5.1)

In scope of this release we updated [actions/core to
1.10.0](https://github.com/actions/setup-node/pull/587). Moreover, we
added logic [to print Nodejs, Npm, Yarn
versions](https://github.com/actions/setup-node/pull/368) after
installation.

###
[`v3.5.0`](https://github.com/actions/setup-node/releases/tag/v3.5.0)

[Compare
Source](https://github.com/actions/setup-node/compare/v3.4.1...v3.5.0)

In scope of this release we add support for engines.node. The action
will be able to grab the version form package.json#engines.node.
[https://github.com/actions/setup-node/pull/485](https://github.com/actions/setup-node/pull/485).
Moreover, we [added support for
Volta](https://github.com/actions/setup-node/pull/532)

Besides, we updated [@&#8203;actions/core to
1.9.1](https://github.com/actions/setup-node/pull/574) and
[@&#8203;actions/cache to
3.0.4](https://github.com/actions/setup-node/pull/573)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click
this checkbox.

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/BirthdayResearch/sticky).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4yMzguNCIsInVwZGF0ZWRJblZlciI6IjMyLjIzOC40In0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@twiddler
Copy link

twiddler commented Nov 4, 2022

Up until now I used

strategy:
    matrix:
        node: ['14', '16', '18']
steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v2
      with:
          node-version: ${{ matrix.node }}

in my action to test on multiple node versions. Can I use node-version-file: 'package.json' in a way that I define

"engines": {
    "node": "^14 || ^16  || ^18"
},

in package.json and still get a test matrix in my action?

Thanks in advance! 🙏

@XDoubleU
Copy link

XDoubleU commented Apr 1, 2023

Up until now I used

strategy:
    matrix:
        node: ['14', '16', '18']
steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-node@v2
      with:
          node-version: ${{ matrix.node }}

in my action to test on multiple node versions. Can I use node-version-file: 'package.json' in a way that I define

"engines": {
    "node": "^14 || ^16  || ^18"
},

in package.json and still get a test matrix in my action?

Thanks in advance! 🙏

@twiddler I want to achieve this too, did you manage to do this? I don't think this belongs inside the scope of setup-node (since strategy matrix is not defined inside the steps of an action) but maybe you have some workaround.

@twiddler
Copy link

twiddler commented Apr 1, 2023

@XDoubleU No, I haven't. I think a workaround would overcomplicate things, at least if it involved generating github actions with scripts that jq stuff from package.json. And I can't think of anything smarter right now. 🤔

CrispyBaguette pushed a commit to CrispyBaguette/wasm-palette-converter that referenced this pull request Nov 8, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [actions/setup-node](https://github.com/actions/setup-node) | action | major | `v2.5.2` -> `v4.1.0` |

---

### Release Notes

<details>
<summary>actions/setup-node (actions/setup-node)</summary>

### [`v4.1.0`](https://github.com/actions/setup-node/releases/tag/v4.1.0)

[Compare Source](actions/setup-node@v4.0.4...v4.1.0)

#### What's Changed

-   Resolve High Security Alerts by upgrading Dependencies by [@&#8203;aparnajyothi-y](https://github.com/aparnajyothi-y) in actions/setup-node#1132
-   Upgrade IA Publish by [@&#8203;Jcambass](https://github.com/Jcambass) in actions/setup-node#1134
-   Revise `isGhes` logic by [@&#8203;jww3](https://github.com/jww3) in actions/setup-node#1148
-   Add architecture to cache key by [@&#8203;pengx17](https://github.com/pengx17) in actions/setup-node#843
    This addresses issues with caching by adding the architecture (arch) to the cache key, ensuring that cache keys are accurate to prevent conflicts.
    Note: This change may break previous cache keys as they will no longer be compatible with the new format.

#### New Contributors

-   [@&#8203;jww3](https://github.com/jww3) made their first contribution in actions/setup-node#1148
-   [@&#8203;pengx17](https://github.com/pengx17) made their first contribution in actions/setup-node#843

**Full Changelog**: actions/setup-node@v4...v4.1.0

### [`v4.0.4`](https://github.com/actions/setup-node/releases/tag/v4.0.4)

[Compare Source](actions/setup-node@v4.0.3...v4.0.4)

#### What's Changed

-   Add workflow file for publishing releases to immutable action package by [@&#8203;Jcambass](https://github.com/Jcambass) in actions/setup-node#1125
-   Enhance Windows ARM64 Setup and Update micromatch Dependency by [@&#8203;priyagupta108](https://github.com/priyagupta108) in actions/setup-node#1126

##### Documentation changes:

-   Documentation update in the README file by [@&#8203;suyashgaonkar](https://github.com/suyashgaonkar) in actions/setup-node#1106
-   Correct invalid 'lts' version string reference by [@&#8203;fulldecent](https://github.com/fulldecent) in actions/setup-node#1124

#### New Contributors

-   [@&#8203;suyashgaonkar](https://github.com/suyashgaonkar) made their first contribution in actions/setup-node#1106
-   [@&#8203;priyagupta108](https://github.com/priyagupta108) made their first contribution in actions/setup-node#1126
-   [@&#8203;Jcambass](https://github.com/Jcambass) made their first contribution in actions/setup-node#1125
-   [@&#8203;fulldecent](https://github.com/fulldecent) made their first contribution in actions/setup-node#1124

**Full Changelog**: actions/setup-node@v4...v4.0.4

### [`v4.0.3`](https://github.com/actions/setup-node/releases/tag/v4.0.3)

[Compare Source](actions/setup-node@v4.0.2...v4.0.3)

#### What's Changed

##### Bug fixes:

-   Fix macos latest check failures by [@&#8203;HarithaVattikuti](https://github.com/HarithaVattikuti) in actions/setup-node#1041

##### Documentation changes:

-   Documentation update to update default Node version to 20 by [@&#8203;bengreeley](https://github.com/bengreeley) in actions/setup-node#949

##### Dependency  updates:

-   Bump undici from 5.26.5 to 5.28.3 by [@&#8203;dependabot](https://github.com/dependabot) in actions/setup-node#965
-   Bump braces from 3.0.2 to 3.0.3 and other dependency updates by [@&#8203;dependabot](https://github.com/dependabot) in actions/setup-node#1087

#### New Contributors

-   [@&#8203;bengreeley](https://github.com/bengreeley) made their first contribution in actions/setup-node#949
-   [@&#8203;HarithaVattikuti](https://github.com/HarithaVattikuti) made their first contribution in actions/setup-node#1041

**Full Changelog**: actions/setup-node@v4...v4.0.3

### [`v4.0.2`](https://github.com/actions/setup-node/releases/tag/v4.0.2)

[Compare Source](actions/setup-node@v4.0.1...v4.0.2)

#### What's Changed

-   Add support for `volta.extends` by [@&#8203;ThisIsManta](https://github.com/ThisIsManta) in actions/setup-node#921
-   Add support for arm64 Windows by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#927

#### New Contributors

-   [@&#8203;ThisIsManta](https://github.com/ThisIsManta) made their first contribution in actions/setup-node#921

**Full Changelog**: actions/setup-node@v4.0.1...v4.0.2

### [`v4.0.1`](https://github.com/actions/setup-node/releases/tag/v4.0.1)

[Compare Source](actions/setup-node@v4.0.0...v4.0.1)

#### What's Changed

-   Ignore engines in Yarn 1 e2e-cache tests by [@&#8203;trivikr](https://github.com/trivikr) in actions/setup-node#882
-   Update setup-node references in the README.md file to setup-node@v4 by [@&#8203;jwetzell](https://github.com/jwetzell) in actions/setup-node#884
-   Update reusable workflows to use Node.js v20 by [@&#8203;MaksimZhukov](https://github.com/MaksimZhukov) in actions/setup-node#889
-   Add fix for cache to resolve slow post action step by [@&#8203;aparnajyothi-y](https://github.com/aparnajyothi-y) in actions/setup-node#917
-   Fix README.md by [@&#8203;takayamaki](https://github.com/takayamaki) in actions/setup-node#898
-   Add `package.json` to `node-version-file` list of examples. by [@&#8203;TWiStErRob](https://github.com/TWiStErRob) in actions/setup-node#879
-   Fix node-version-file interprets entire package.json as a version by [@&#8203;NullVoxPopuli](https://github.com/NullVoxPopuli) in actions/setup-node#865

#### New Contributors

-   [@&#8203;trivikr](https://github.com/trivikr) made their first contribution in actions/setup-node#882
-   [@&#8203;jwetzell](https://github.com/jwetzell) made their first contribution in actions/setup-node#884
-   [@&#8203;aparnajyothi-y](https://github.com/aparnajyothi-y) made their first contribution in actions/setup-node#917
-   [@&#8203;takayamaki](https://github.com/takayamaki) made their first contribution in actions/setup-node#898
-   [@&#8203;TWiStErRob](https://github.com/TWiStErRob) made their first contribution in actions/setup-node#879
-   [@&#8203;NullVoxPopuli](https://github.com/NullVoxPopuli) made their first contribution in actions/setup-node#865

**Full Changelog**: actions/setup-node@v4...v4.0.1

### [`v4.0.0`](https://github.com/actions/setup-node/releases/tag/v4.0.0)

[Compare Source](actions/setup-node@v3.8.2...v4.0.0)

#### What's Changed

In scope of this release we changed version of node runtime for action from node16 to node20 and updated dependencies in actions/setup-node#866

Besides, release contains such changes as:

-   Upgrade actions/checkout to v4 by [@&#8203;gmembre-zenika](https://github.com/gmembre-zenika) in actions/setup-node#868
-   Update actions/checkout for documentation and yaml by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#876

#### New Contributors

-   [@&#8203;gmembre-zenika](https://github.com/gmembre-zenika) made their first contribution in actions/setup-node#868

**Full Changelog**: actions/setup-node@v3...v4.0.0

### [`v3.8.2`](https://github.com/actions/setup-node/releases/tag/v3.8.2)

[Compare Source](actions/setup-node@v3.8.1...v3.8.2)

#### What's Changed

-   Update semver by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#861
-   Update temp directory creation by [@&#8203;nikolai-laevskii](https://github.com/nikolai-laevskii) in actions/setup-node#859
-   Bump [@&#8203;babel/traverse](https://github.com/babel/traverse) from 7.15.4 to 7.23.2 by [@&#8203;dependabot](https://github.com/dependabot) in actions/setup-node#870
-   Add notice about binaries not being updated yet by [@&#8203;nikolai-laevskii](https://github.com/nikolai-laevskii) in actions/setup-node#872
-   Update toolkit cache and core by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) and [@&#8203;seongwon-privatenote](https://github.com/seongwon-privatenote) in actions/setup-node#875

**Full Changelog**: actions/setup-node@v3...v3.8.2

### [`v3.8.1`](https://github.com/actions/setup-node/releases/tag/v3.8.1)

[Compare Source](actions/setup-node@v3.8.0...v3.8.1)

#### What's Changed

In scope of this release, the filter was removed within the cache-save step by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#831. It is filtered and checked in the toolkit/cache library.

**Full Changelog**: actions/setup-node@v3...v3.8.1

### [`v3.8.0`](https://github.com/actions/setup-node/releases/tag/v3.8.0)

[Compare Source](actions/setup-node@v3.7.0...v3.8.0)

#### What's Changed

##### Bug fixes:

-   Add check for existing paths by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#803
-   Resolve SymbolicLink by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#809
-   Change passing logic for cache input by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#816
-   Fix armv7 cache issue by [@&#8203;louislam](https://github.com/louislam) in actions/setup-node#794
-   Update check-dist workflow name by [@&#8203;sinchang](https://github.com/sinchang) in actions/setup-node#710

##### Feature implementations:

-   feat: handling the case where "node" is used for tool-versions file. by [@&#8203;xytis](https://github.com/xytis) in actions/setup-node#812

##### Documentation changes:

-   Refer to semver package name in README.md by [@&#8203;olleolleolle](https://github.com/olleolleolle) in actions/setup-node#808

##### Update dependencies:

-   Update toolkit cache to fix zstd by [@&#8203;dmitry-shibanov](https://github.com/dmitry-shibanov) in actions/setup-node#804
-   Bump tough-cookie and [@&#8203;azure/ms-rest-js](https://github.com/azure/ms-rest-js) by [@&#8203;dependabot](https://github.com/dependabot) in actions/setup-node#802
-   Bump semver from 6.1.2 to 6.3.1 by [@&#8203;dependabot](https://github.com/dependabot) in actions/setup-node#807
-   Bump word-wrap from 1.2.3 to 1.2.4 by [@&#8203;dependabot](https://github.com/dependabot) in actions/setup-node#815

#### New Contributors

-   [@&#8203;olleolleolle](https://github.com/olleolleolle) made their first contribution in actions/setup-node#808
-   [@&#8203;louislam](https://github.com/louislam) made their first contribution in actions/setup-node#794
-   [@&#8203;sinchang](https://github.com/sinchang) made their first contribution in actions/setup-node#710
-   [@&#8203;xytis](https://github.com/xytis) made their first contribution in actions/setup-node#812

**Full Changelog**: actions/setup-node@v3...v3.8.0

### [`v3.7.0`](https://github.com/actions/setup-node/releases/tag/v3.7.0)

[Compare Source](actions/setup-node@v3.6.0...v3.7.0)

#### What's Changed

In scope of this release we added a logic to save an additional cache path for yarn 3 ([related pull request](actions/setup-node#744) and [feature request](actions/setup-node#325)). Moreover, we added functionality to use all the sub directories derived from `cache-dependency-path` input and add detect all dependencies directories to cache (related [pull request](actions/setup-node#735) and [feature request](actions/setup-node#488)).

##### Besides, we made such changes as:

-   Replace workflow badge with new badge by [@&#8203;jongwooo](https://github.com/jongwooo) in actions/setup-node#653
-   Fix a minor typo by [@&#8203;phanan](https://github.com/phanan) in actions/setup-node#662
-   docs: fix typo in advanced-usage.md by [@&#8203;remarkablemark](https://github.com/remarkablemark) in actions/setup-node#697
-   bugfix: Don't attempt to use Windows fallbacks on non-Windows OSes by [@&#8203;domdomegg](https://github.com/domdomegg) in actions/setup-node#718
-   Update to node 18.x by [@&#8203;feelepxyz](https://github.com/feelepxyz) in actions/setup-node#751
-   Remove implicit dependencies by [@&#8203;nikolai-laevskii](https://github.com/nikolai-laevskii) in actions/setup-node#758
-   Fix description about ensuring workflow access to private package by [@&#8203;x86chi](https://github.com/x86chi) in actions/setup-node#704

#### New Contributors

-   [@&#8203;jongwooo](https://github.com/jongwooo) made their first contribution in actions/setup-node#653
-   [@&#8203;phanan](https://github.com/phanan) made their first contribution in actions/setup-node#662
-   [@&#8203;remarkablemark](https://github.com/remarkablemark) made their first contribution in actions/setup-node#697
-   [@&#8203;domdomegg](https://github.com/domdomegg) made their first contribution in actions/setup-node#718
-   [@&#8203;feelepxyz](https://github.com/feelepxyz) made their first contribution in actions/setup-node#751
-   [@&#8203;nikolai-laevskii](https://github.com/nikolai-laevskii) made their first contribution in actions/setup-node#758
-   [@&#8203;x86chi](https://github.com/x86chi) made their first contribution in actions/setup-node#704

**Full Changelog**: actions/setup-node@v3...v3.7.0

### [`v3.6.0`](https://github.com/actions/setup-node/releases/tag/v3.6.0): Add Support for Nightly, Canary and RC builds for Node.js

[Compare Source](actions/setup-node@v3.5.1...v3.6.0)

In scope of this release we added support to download nightly, rc (actions/setup-node#611) and canary (actions/setup-node#619) Node.js distributions.

##### For nightly versions:

```yaml
jobs:
  build:
    runs-on: ubuntu-latest
    name: Node sample
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '16-nightly'
      - run: npm ci
      - run: npm test
```

##### For canary versions:

```yaml
jobs:
  build:
    runs-on: ubuntu-latest
    name: Node sample
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '16-v8-canary’
      - run: npm ci
      - run: npm test
```

##### For rc versions:

```yaml
jobs:
  build:
    runs-on: ubuntu-latest
    name: Node sample
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: '16.0.0-rc.1’
      - run: npm ci
      - run: npm test
```

Note: For more examples please refer to [documentation](https://github.com/actions/setup-node#advanced-usage).

Besides, we added the following changes as:

-   Updated minimatch: actions/setup-node#608
-   Fixed extra newline character in version output when reading from a file: actions/setup-node#625
-   Passed the token input through on GHES: actions/setup-node#595
-   Fixed issue with scoped registries are duplicated in npmrc: actions/setup-node#637

### [`v3.5.1`](https://github.com/actions/setup-node/releases/tag/v3.5.1): Update @&#8203;actions/core and Print Node, Npm, Yarn versions

[Compare Source](actions/setup-node@v3.5.0...v3.5.1)

In scope of this release we updated [actions/core to 1.10.0](actions/setup-node#587). Moreover, we added logic [to print Nodejs, Npm, Yarn versions](actions/setup-node#368) after installation.

### [`v3.5.0`](https://github.com/actions/setup-node/releases/tag/v3.5.0): Add support for engines.node and Volta

[Compare Source](actions/setup-node@v3.4.1...v3.5.0)

In scope of this release we add support for engines.node. The action will be able to grab the version form package.json#engines.node. actions/setup-node#485. Moreover, we [added support for Volta](actions/setup-node#532)

Besides, we updated [@&#8203;actions/core to 1.9.1](actions/setup-node#574) and [@&#8203;actions/cache to 3.0.4](actions/setup-node#573)

### [`v3.4.1`](https://github.com/actions/setup-node/releases/tag/v3.4.1): Fix pnpm output and node-version  output issues

[Compare Source](actions/setup-node@v3.4.0...v3.4.1)

In scope of this release we fixed bugs related to the pnpm 7.5.1 output issue from `pnpm store path` actions/setup-node#545. Moreover we fixed the issue with falling on node-version output actions/setup-node#540.

### [`v3.4.0`](https://github.com/actions/setup-node/releases/tag/v3.4.0): Add support for asdf format and update actions/cache version to 3.0.0

[Compare Source](actions/setup-node@v3.3.0...v3.4.0)

In scope of this release we updated `actions/cache` package as the new version contains fixes for [caching error handling](actions/setup-node#526). Moreover, we added support for asdf format as Node.js version file actions/setup-node#373. Besides, we introduced new output [node-version](actions/setup-node#534) and added `npm-shrinkwrap.json` to dependency file patterns: actions/setup-node#439

### [`v3.3.0`](https://github.com/actions/setup-node/releases/tag/v3.3.0): Add support for lts/-n aliases

[Compare Source](actions/setup-node@v3.2.0...v3.3.0)

In scope of this release we added support for `lts/-n` aliases, improve logic for `current`, `latest` and `node` aliases to handle them from `toolcache`, update `ncc` package.

##### Support of lts/-n aliases

-   Related pull request: actions/setup-node#481
-   Related issue: actions/setup-node#26

```yaml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
  with:
    node-version: lts/-1
- run: npm ci
- run: npm test
```

##### Minor improvements

-   Update zeit/ncc to vercel/ncc: actions/setup-node#476
-   Get latest version from cache if exists: actions/setup-node#496

### [`v3.2.0`](https://github.com/actions/setup-node/releases/tag/v3.2.0): Add current, node, latest aliases

[Compare Source](actions/setup-node@v3.1.1...v3.2.0)

In scope of this release we added new aliases to install the latest Node.js version. actions/setup-node#483

```yml
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
  with:
    node-version: current
- run: npm ci
- run: npm test
```

### [`v3.1.1`](https://github.com/actions/setup-node/releases/tag/v3.1.1): Update actions/cache version to 2.0.2

[Compare Source](actions/setup-node@v3.1.0...v3.1.1)

In scope of this release we updated `actions/cache` package as the new version contains fixes related to GHES 3.5 (actions/setup-node#460)

### [`v3.1.0`](https://github.com/actions/setup-node/releases/tag/v3.1.0): Add caching support on GHES 3.5

[Compare Source](actions/setup-node@v3.0.0...v3.1.0)

In scope of this release we added [support for caching from GHES 3.5](actions/setup-node#452) and fixed download issue for files > 2GB during restore. Besides, we updated `actions/cache` dependency to 2.0.0 version.

### [`v3.0.0`](https://github.com/actions/setup-node/releases/tag/v3.0.0)

[Compare Source](actions/setup-node@v2.5.2...v3.0.0)

In scope of this release we changed version of the runtime Node.js for the setup-node action and updated package-lock.json file to  v2.

##### Breaking Changes

-   With the update to Node 16 in actions/setup-node#414, all scripts will now be run with Node 16 rather than Node 12.
-   We removed deprecated `version` input (actions/setup-node#424). Please use `node-version` input instead.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS44LjAiLCJ1cGRhdGVkSW5WZXIiOiIzOS44LjAiLCJ0YXJnZXRCcmFuY2giOiJtYXN0ZXIiLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: https://gitea.bruyant.xyz/alexandre/PaletteSwitcher/pulls/56
Co-authored-by: Renovate <[email protected]>
Co-committed-by: Renovate <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants