mirror of
https://github.com/actions/setup-node.git
synced 2026-06-14 14:13:52 +08:00
Compare commits
11 Commits
v5.0.0
...
125ebc14e0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
125ebc14e0 | ||
|
|
dda4788290 | ||
|
|
6dd044cc77 | ||
|
|
006364163b | ||
|
|
0b341692b6 | ||
|
|
81b484e462 | ||
|
|
100690a6a6 | ||
|
|
2028fbc5c2 | ||
|
|
13427813f7 | ||
|
|
89d709d423 | ||
|
|
cd2651c462 |
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
@@ -16,4 +16,4 @@ jobs:
|
|||||||
name: Check dist/
|
name: Check dist/
|
||||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
||||||
with:
|
with:
|
||||||
node-version: '20.x'
|
node-version: '24.x'
|
||||||
|
|||||||
66
.github/workflows/e2e-cache.yml
vendored
66
.github/workflows/e2e-cache.yml
vendored
@@ -18,8 +18,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Clean global cache
|
- name: Clean global cache
|
||||||
@@ -41,8 +41,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
@@ -74,8 +74,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18, 20, 24]
|
node-version: [20, 22, 24]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Yarn version
|
- name: Yarn version
|
||||||
@@ -106,8 +106,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Update yarn
|
- name: Update yarn
|
||||||
@@ -139,7 +139,7 @@ jobs:
|
|||||||
name: Test yarn subprojects
|
name: Test yarn subprojects
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -166,7 +166,7 @@ jobs:
|
|||||||
name: Test yarn subprojects all locally managed
|
name: Test yarn subprojects all locally managed
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -193,7 +193,7 @@ jobs:
|
|||||||
name: Test yarn subprojects some locally managed
|
name: Test yarn subprojects some locally managed
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -220,7 +220,7 @@ jobs:
|
|||||||
name: Test yarn subprojects managed by git
|
name: Test yarn subprojects managed by git
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@@ -244,14 +244,14 @@ jobs:
|
|||||||
sub2/*.lock
|
sub2/*.lock
|
||||||
sub3/*.lock
|
sub3/*.lock
|
||||||
|
|
||||||
node-npm-package-manager-cache:
|
node-npm-packageManager-auto-cache:
|
||||||
name: Test enabling cache if package manager field is present (Node ${{ matrix.node-version }}, ${{ matrix.os }})
|
name: Test auto cache with top-level packageManager
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18, 20, 22]
|
node-version: [20, 22, 24]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Create package.json with packageManager field
|
- name: Create package.json with packageManager field
|
||||||
@@ -268,3 +268,37 @@ jobs:
|
|||||||
- name: Verify node and npm
|
- name: Verify node and npm
|
||||||
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
|
node-npm-devEngines-auto-cache:
|
||||||
|
name: Test auto cache with devEngines.packageManager
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
|
node-version: [20, 22, 24]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- name: Create package.json with devEngines field
|
||||||
|
run: |
|
||||||
|
echo '{
|
||||||
|
"name": "test-project",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"devEngines": {
|
||||||
|
"packageManager": {
|
||||||
|
"name": "npm",
|
||||||
|
"onFail": "error"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}' > package.json
|
||||||
|
- name: Clean global cache
|
||||||
|
run: npm cache clean --force
|
||||||
|
- name: Setup Node with caching enabled
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
- name: Verify node and npm
|
||||||
|
run: __tests__/verify-node.sh "${{ matrix.node-version }}"
|
||||||
|
shell: bash
|
||||||
|
|||||||
12
.github/workflows/proxy.yml
vendored
12
.github/workflows/proxy.yml
vendored
@@ -28,12 +28,12 @@ jobs:
|
|||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Clear tool cache
|
- name: Clear tool cache
|
||||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||||
- name: Setup node 14
|
- name: Setup node 24
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
node-version: 14.x
|
node-version: 24.x
|
||||||
- name: Verify node and npm
|
- name: Verify node and npm
|
||||||
run: __tests__/verify-node.sh 14
|
run: __tests__/verify-node.sh 24
|
||||||
|
|
||||||
test-bypass-proxy:
|
test-bypass-proxy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -44,9 +44,9 @@ jobs:
|
|||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Clear tool cache
|
- name: Clear tool cache
|
||||||
run: rm -rf $RUNNER_TOOL_CACHE/*
|
run: rm -rf $RUNNER_TOOL_CACHE/*
|
||||||
- name: Setup node 11
|
- name: Setup node 24
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
node-version: 11
|
node-version: 24
|
||||||
- name: Verify node and npm
|
- name: Verify node and npm
|
||||||
run: __tests__/verify-node.sh 11
|
run: __tests__/verify-node.sh 24
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Update the ${{ env.TAG_NAME }} tag
|
- name: Update the ${{ env.TAG_NAME }} tag
|
||||||
uses: actions/publish-action@v0.3.0
|
uses: actions/publish-action@v0.4.0
|
||||||
with:
|
with:
|
||||||
source-tag: ${{ env.TAG_NAME }}
|
source-tag: ${{ env.TAG_NAME }}
|
||||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
|||||||
36
.github/workflows/versions.yml
vendored
36
.github/workflows/versions.yml
vendored
@@ -17,8 +17,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest-large]
|
||||||
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
|
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
@@ -56,7 +56,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version:
|
node-version:
|
||||||
[
|
[
|
||||||
'20-v8-canary',
|
'20-v8-canary',
|
||||||
@@ -81,8 +81,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [20-nightly, 21-nightly, 18.0.0-nightly]
|
node-version: [20-nightly, 25-nightly, 24.0.0-nightly]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
@@ -101,8 +101,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
|
node-version: [20.0.0-rc.1, 22.14.0-rc.1, 24.0.0-rc.4]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
@@ -121,8 +121,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18.20.0, 20.10.0, 22.0.0]
|
node-version: [20.10.0, 22.0.0, 24.9.0]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
@@ -138,8 +138,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [18, 20, 22, 24]
|
node-version: [20, 22, 24]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup Node and check latest
|
- name: Setup Node and check latest
|
||||||
@@ -156,7 +156,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version-file:
|
node-version-file:
|
||||||
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
|
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
|
||||||
steps:
|
steps:
|
||||||
@@ -173,7 +173,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup node from node version file
|
- name: Setup node from node version file
|
||||||
@@ -188,7 +188,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup node from node version file
|
- name: Setup node from node version file
|
||||||
@@ -203,7 +203,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [17, 19]
|
node-version: [17, 19]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
@@ -220,7 +220,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest-large]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
# test old versions which didn't have npm and layout different
|
# test old versions which didn't have npm and layout different
|
||||||
@@ -250,7 +250,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||||
node-version: [current, latest, node]
|
node-version: [current, latest, node]
|
||||||
steps:
|
steps:
|
||||||
- name: Get node version
|
- name: Get node version
|
||||||
|
|||||||
35
.licenses/npm/data-uri-to-buffer.dep.yml
generated
Normal file
35
.licenses/npm/data-uri-to-buffer.dep.yml
generated
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: data-uri-to-buffer
|
||||||
|
version: 4.0.1
|
||||||
|
type: npm
|
||||||
|
summary: Generate a Buffer instance from a Data URI string
|
||||||
|
homepage: https://github.com/TooTallNate/node-data-uri-to-buffer
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: README.md
|
||||||
|
text: |-
|
||||||
|
(The MIT License)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
'Software'), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||||
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
[rfc]: http://tools.ietf.org/html/rfc2397
|
||||||
|
notices: []
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
---
|
---
|
||||||
name: whatwg-url
|
name: fetch-blob
|
||||||
version: 5.0.0
|
version: 3.2.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery
|
summary: Blob & File implementation in Node.js, originally from node-fetch.
|
||||||
homepage:
|
homepage: https://github.com/node-fetch/fetch-blob#readme
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.txt
|
- sources: LICENSE
|
||||||
text: |
|
text: |
|
||||||
The MIT License (MIT)
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2015–2016 Sebastian Mayr
|
Copyright (c) 2019 David Frank
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -19,14 +19,14 @@ licenses:
|
|||||||
copies of the Software, and to permit persons to whom the Software is
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
furnished to do so, subject to the following conditions:
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
The above copyright notice and this permission notice shall be included in all
|
||||||
all copies or substantial portions of the Software.
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
THE SOFTWARE.
|
SOFTWARE.
|
||||||
notices: []
|
notices: []
|
||||||
@@ -1,15 +1,17 @@
|
|||||||
---
|
---
|
||||||
name: tr46
|
name: formdata-polyfill
|
||||||
version: 0.0.3
|
version: 4.0.10
|
||||||
type: npm
|
type: npm
|
||||||
summary: An implementation of the Unicode TR46 spec
|
summary: HTML5 `FormData` for Browsers and Node.
|
||||||
homepage: https://github.com/Sebmaster/tr46.js#readme
|
homepage: https://github.com/jimmywarting/FormData#readme
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: Auto-generated MIT license text
|
- sources: LICENSE
|
||||||
text: |
|
text: |
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2016 Jimmy Karl Roland Wärting
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
in the Software without restriction, including without limitation the rights
|
in the Software without restriction, including without limitation the rights
|
||||||
32
.licenses/npm/node-domexception.dep.yml
generated
Normal file
32
.licenses/npm/node-domexception.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: node-domexception
|
||||||
|
version: 1.0.0
|
||||||
|
type: npm
|
||||||
|
summary: An implementation of the DOMException class from NodeJS
|
||||||
|
homepage: https://github.com/jimmywarting/node-domexception#readme
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2021 Jimmy Wärting
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
notices: []
|
||||||
29
.licenses/npm/node-fetch.dep.yml
generated
29
.licenses/npm/node-fetch.dep.yml
generated
@@ -1,16 +1,16 @@
|
|||||||
---
|
---
|
||||||
name: node-fetch
|
name: node-fetch
|
||||||
version: 2.7.0
|
version: 3.3.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: A light-weight module that brings window.fetch to node.js
|
summary: A light-weight module that brings Fetch API to node.js
|
||||||
homepage: https://github.com/bitinn/node-fetch
|
homepage: https://github.com/node-fetch/node-fetch
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE.md
|
- sources: LICENSE.md
|
||||||
text: |+
|
text: |+
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 David Frank
|
Copyright (c) 2016 - 2020 Node Fetch Team
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -32,25 +32,14 @@ licenses:
|
|||||||
|
|
||||||
- sources: README.md
|
- sources: README.md
|
||||||
text: |-
|
text: |-
|
||||||
MIT
|
[MIT](LICENSE.md)
|
||||||
|
|
||||||
[npm-image]: https://flat.badgen.net/npm/v/node-fetch
|
|
||||||
[npm-url]: https://www.npmjs.com/package/node-fetch
|
|
||||||
[travis-image]: https://flat.badgen.net/travis/bitinn/node-fetch
|
|
||||||
[travis-url]: https://travis-ci.org/bitinn/node-fetch
|
|
||||||
[codecov-image]: https://flat.badgen.net/codecov/c/github/bitinn/node-fetch/master
|
|
||||||
[codecov-url]: https://codecov.io/gh/bitinn/node-fetch
|
|
||||||
[install-size-image]: https://flat.badgen.net/packagephobia/install/node-fetch
|
|
||||||
[install-size-url]: https://packagephobia.now.sh/result?p=node-fetch
|
|
||||||
[discord-image]: https://img.shields.io/discord/619915844268326952?color=%237289DA&label=Discord&style=flat-square
|
|
||||||
[discord-url]: https://discord.gg/Zxbndcm
|
|
||||||
[opencollective-image]: https://opencollective.com/node-fetch/backers.svg
|
|
||||||
[opencollective-url]: https://opencollective.com/node-fetch
|
|
||||||
[whatwg-fetch]: https://fetch.spec.whatwg.org/
|
[whatwg-fetch]: https://fetch.spec.whatwg.org/
|
||||||
[response-init]: https://fetch.spec.whatwg.org/#responseinit
|
[response-init]: https://fetch.spec.whatwg.org/#responseinit
|
||||||
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
|
[node-readable]: https://nodejs.org/api/stream.html#stream_readable_streams
|
||||||
[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
|
[mdn-headers]: https://developer.mozilla.org/en-US/docs/Web/API/Headers
|
||||||
[LIMITS.md]: https://github.com/bitinn/node-fetch/blob/master/LIMITS.md
|
[error-handling.md]: https://github.com/node-fetch/node-fetch/blob/master/docs/ERROR-HANDLING.md
|
||||||
[ERROR-HANDLING.md]: https://github.com/bitinn/node-fetch/blob/master/ERROR-HANDLING.md
|
[FormData]: https://developer.mozilla.org/en-US/docs/Web/API/FormData
|
||||||
[UPGRADE-GUIDE.md]: https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md
|
[Blob]: https://developer.mozilla.org/en-US/docs/Web/API/Blob
|
||||||
|
[File]: https://developer.mozilla.org/en-US/docs/Web/API/File
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: semver
|
name: semver
|
||||||
version: 7.6.3
|
version: 7.7.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: The semantic version parser used by npm.
|
summary: The semantic version parser used by npm.
|
||||||
homepage:
|
homepage:
|
||||||
33
.licenses/npm/web-streams-polyfill.dep.yml
generated
Normal file
33
.licenses/npm/web-streams-polyfill.dep.yml
generated
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
name: web-streams-polyfill
|
||||||
|
version: 3.3.3
|
||||||
|
type: npm
|
||||||
|
summary: Web Streams, based on the WHATWG spec reference implementation
|
||||||
|
homepage: https://github.com/MattiasBuelens/web-streams-polyfill#readme
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2024 Mattias Buelens
|
||||||
|
Copyright (c) 2016 Diwank Singh Tomer
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
notices: []
|
||||||
23
.licenses/npm/webidl-conversions.dep.yml
generated
23
.licenses/npm/webidl-conversions.dep.yml
generated
@@ -1,23 +0,0 @@
|
|||||||
---
|
|
||||||
name: webidl-conversions
|
|
||||||
version: 3.0.1
|
|
||||||
type: npm
|
|
||||||
summary: Implements the WebIDL algorithms for converting to and from JavaScript values
|
|
||||||
homepage:
|
|
||||||
license: bsd-2-clause
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE.md
|
|
||||||
text: |
|
|
||||||
# The BSD 2-Clause License
|
|
||||||
|
|
||||||
Copyright (c) 2014, Domenic Denicola
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
notices: []
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
// This is a reusable configuration file copied from https://github.com/actions/reusable-workflows/tree/main/reusable-configurations. Please don't make changes to this file as it's the subject of an automatic update.
|
||||||
module.exports = {
|
export default {
|
||||||
printWidth: 80,
|
printWidth: 80,
|
||||||
tabWidth: 2,
|
tabWidth: 2,
|
||||||
useTabs: false,
|
useTabs: false,
|
||||||
|
|||||||
75
README.md
75
README.md
@@ -12,13 +12,27 @@ This action provides the following functionality for GitHub Actions users:
|
|||||||
- Registering problem matchers for error output
|
- Registering problem matchers for error output
|
||||||
- Configuring authentication for GPR or npm
|
- Configuring authentication for GPR or npm
|
||||||
|
|
||||||
|
## Breaking changes in V6
|
||||||
|
|
||||||
|
- Caching is now automatically enabled for npm projects when either the `devEngines.packageManager` field or the top-level `packageManager` field in `package.json` is set to `npm`. For other package managers, such as Yarn and pnpm, caching is disabled by default and must be configured manually using the `cache` input.
|
||||||
|
|
||||||
|
## Breaking changes in V5
|
||||||
|
|
||||||
|
- Enabled caching by default with package manager detection if no cache input is provided.
|
||||||
|
> For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching by setting `package-manager-cache: false` when caching is not needed for secure operation.
|
||||||
|
|
||||||
|
- Upgraded action from node20 to node24.
|
||||||
|
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
|
||||||
|
|
||||||
|
For more details, see the full release notes on the [releases page](https://github.com/actions/setup-node/releases/v5.0.0)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
See [action.yml](action.yml)
|
See [action.yml](action.yml)
|
||||||
|
|
||||||
<!-- start usage -->
|
<!-- start usage -->
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
# Version Spec of the version to use in SemVer notation.
|
# Version Spec of the version to use in SemVer notation.
|
||||||
# It also admits such aliases as lts/*, latest, nightly and canary builds
|
# It also admits such aliases as lts/*, latest, nightly and canary builds
|
||||||
@@ -57,6 +71,11 @@ See [action.yml](action.yml)
|
|||||||
# Default: ''
|
# Default: ''
|
||||||
cache: ''
|
cache: ''
|
||||||
|
|
||||||
|
# Controls automatic caching for npm. By default, caching for npm is enabled if either the devEngines.packageManager field or the top-level packageManager field in package.json specifies npm and no explicit cache input is provided.
|
||||||
|
# To disable automatic caching for npm, set package-manager-cache to false.
|
||||||
|
# default: true
|
||||||
|
package-manager-cache: true
|
||||||
|
|
||||||
# Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc.
|
# Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc.
|
||||||
# It will generate hash from the target file for primary key. It works only If cache is specified.
|
# It will generate hash from the target file for primary key. It works only If cache is specified.
|
||||||
# Supports wildcards or a list of file names for caching multiple dependencies.
|
# Supports wildcards or a list of file names for caching multiple dependencies.
|
||||||
@@ -99,9 +118,9 @@ See [action.yml](action.yml)
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 24
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -118,9 +137,9 @@ The `node-version` input supports the Semantic Versioning Specification, for mor
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Major versions: `18`, `20`
|
- Major versions: `22`, `24`
|
||||||
- More specific versions: `10.15`, `16.15.1` , `18.4.0`
|
- More specific versions: `20.19`, `22.17.1` , `24.8.0`
|
||||||
- NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n`
|
- NVM LTS syntax: `lts/iron`, `lts/jod`, `lts/*`, `lts/-n`
|
||||||
- Latest release: `*` or `latest`/`current`/`node`
|
- Latest release: `*` or `latest`/`current`/`node`
|
||||||
|
|
||||||
**Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input.
|
**Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input.
|
||||||
@@ -137,18 +156,6 @@ It's **always** recommended to commit the lockfile of your package manager for s
|
|||||||
|
|
||||||
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional.
|
The action has a built-in functionality for caching and restoring dependencies. It uses [actions/cache](https://github.com/actions/cache) under the hood for caching global packages data but requires less configuration settings. Supported package managers are `npm`, `yarn`, `pnpm` (v6.10+). The `cache` input is optional.
|
||||||
|
|
||||||
Caching is turned on by default when a `packageManager` field is detected in the `package.json` file. The `package-manager-cache` input provides control over this automatic caching behavior. By default, `package-manager-cache` is set to `true`, which enables caching when a valid package manager field is detected in the `package.json` file. To disable this automatic caching, set the `package-manager-cache` input to `false`.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
package-manager-cache: false
|
|
||||||
- run: npm ci
|
|
||||||
```
|
|
||||||
> If no valid `packageManager` field is detected in the `package.json` file, caching will remain disabled unless explicitly configured.
|
|
||||||
|
|
||||||
The action defaults to search for the dependency file (`package-lock.json`, `npm-shrinkwrap.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
|
The action defaults to search for the dependency file (`package-lock.json`, `npm-shrinkwrap.json` or `yarn.lock`) in the repository root, and uses its hash as a part of the cache key. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
|
||||||
|
|
||||||
**Note:** The action does not cache `node_modules`
|
**Note:** The action does not cache `node_modules`
|
||||||
@@ -160,9 +167,9 @@ See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` in
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 24
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
@@ -173,15 +180,29 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 24
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: subdir/package-lock.json
|
cache-dependency-path: subdir/package-lock.json
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Caching for npm dependencies is automatically enabled when your `package.json` contains either `devEngines.packageManager` field or top-level `packageManager` field set to `npm`, and no explicit cache input is provided.
|
||||||
|
|
||||||
|
This behavior is controlled by the `package-manager-cache` input, which defaults to `true`. To turn off automatic caching, set `package-manager-cache` to `false`.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
- uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
package-manager-cache: false
|
||||||
|
- run: npm ci
|
||||||
|
```
|
||||||
|
> If your `package.json` file does not include a `packageManager` field set to `npm`, caching will be disabled unless you explicitly enable it. For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching for npm by setting `package-manager-cache: false` when caching is not required for secure operation.
|
||||||
|
|
||||||
## Matrix Testing
|
## Matrix Testing
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -190,12 +211,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node: [ 14, 16, 18 ]
|
node: [ 20, 22, 24 ]
|
||||||
name: Node ${{ matrix.node }} sample
|
name: Node ${{ matrix.node }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@@ -209,10 +230,10 @@ jobs:
|
|||||||
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
|
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
||||||
node-version: 20
|
node-version: 24
|
||||||
```
|
```
|
||||||
|
|
||||||
If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information.
|
If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information.
|
||||||
@@ -250,4 +271,4 @@ Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
|
|||||||
|
|
||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)
|
:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)
|
||||||
@@ -3,17 +3,22 @@ import fs from 'fs';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as io from '@actions/io';
|
import * as io from '@actions/io';
|
||||||
import * as auth from '../src/authutil';
|
import * as auth from '../src/authutil.js';
|
||||||
import * as cacheUtils from '../src/cache-utils';
|
import * as cacheUtils from '../src/cache-utils.js';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
import {jest, describe, beforeEach, afterEach, it, expect} from '@jest/globals';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
let rcFile: string;
|
let rcFile: string;
|
||||||
|
|
||||||
describe('authutil tests', () => {
|
describe('authutil tests', () => {
|
||||||
const _runnerDir = path.join(__dirname, 'runner');
|
const _runnerDir = path.join(__dirname, 'runner');
|
||||||
|
|
||||||
let cnSpy: jest.SpyInstance;
|
let cnSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let logSpy: jest.SpyInstance;
|
let logSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let dbgSpy: jest.SpyInstance;
|
let dbgSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
const randPath = path.join(Math.random().toString(36).substring(7));
|
const randPath = path.join(Math.random().toString(36).substring(7));
|
||||||
|
|||||||
@@ -3,9 +3,13 @@ import * as cache from '@actions/cache';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
import osm from 'os';
|
import osm from 'os';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
import * as utils from '../src/cache-utils';
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
import {restoreCache} from '../src/cache-restore';
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
import * as utils from '../src/cache-utils.js';
|
||||||
|
import {restoreCache} from '../src/cache-restore.js';
|
||||||
|
|
||||||
describe('cache-restore', () => {
|
describe('cache-restore', () => {
|
||||||
process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
|
process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data');
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ import * as cache from '@actions/cache';
|
|||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
import * as utils from '../src/cache-utils';
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
import {run} from '../src/cache-save';
|
const __dirname = path.dirname(__filename);
|
||||||
import {State} from '../src/constants';
|
|
||||||
|
import * as utils from '../src/cache-utils.js';
|
||||||
|
import {run} from '../src/cache-save.js';
|
||||||
|
import {State} from '../src/constants.js';
|
||||||
|
|
||||||
describe('run', () => {
|
describe('run', () => {
|
||||||
const yarnFileHash =
|
const yarnFileHash =
|
||||||
@@ -114,10 +118,10 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
@@ -138,10 +142,10 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
@@ -162,10 +166,10 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/npm`);
|
getCommandOutputSpy.mockImplementationOnce(() => `${commonPath}/npm`);
|
||||||
|
|
||||||
@@ -184,10 +188,10 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
: key === State.CachePrimaryKey || key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
@@ -207,12 +211,12 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CacheMatchedKey
|
: key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
@@ -237,12 +241,12 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CacheMatchedKey
|
: key === State.CacheMatchedKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
@@ -267,12 +271,12 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CacheMatchedKey
|
: key === State.CacheMatchedKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
@@ -297,12 +301,12 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CacheMatchedKey
|
: key === State.CacheMatchedKey
|
||||||
? pnpmFileHash
|
? pnpmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
|
|
||||||
await run();
|
await run();
|
||||||
@@ -327,12 +331,12 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CacheMatchedKey
|
: key === State.CacheMatchedKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
saveCacheSpy.mockImplementation(() => {
|
saveCacheSpy.mockImplementation(() => {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -360,12 +364,12 @@ describe('run', () => {
|
|||||||
key === State.CachePackageManager
|
key === State.CachePackageManager
|
||||||
? inputs['cache']
|
? inputs['cache']
|
||||||
: key === State.CacheMatchedKey
|
: key === State.CacheMatchedKey
|
||||||
? npmFileHash
|
? npmFileHash
|
||||||
: key === State.CachePrimaryKey
|
: key === State.CachePrimaryKey
|
||||||
? yarnFileHash
|
? yarnFileHash
|
||||||
: key === State.CachePaths
|
: key === State.CachePaths
|
||||||
? '["/foo/bar"]'
|
? '["/foo/bar"]'
|
||||||
: 'not expected'
|
: 'not expected'
|
||||||
);
|
);
|
||||||
saveCacheSpy.mockImplementation(() => {
|
saveCacheSpy.mockImplementation(() => {
|
||||||
throw new cache.ValidationError('Validation failed');
|
throw new cache.ValidationError('Validation failed');
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as utils from '../src/cache-utils';
|
import * as utils from '../src/cache-utils.js';
|
||||||
import {
|
import {
|
||||||
PackageManagerInfo,
|
PackageManagerInfo,
|
||||||
isCacheFeatureAvailable,
|
isCacheFeatureAvailable,
|
||||||
supportedPackageManagers,
|
supportedPackageManagers,
|
||||||
isGhes,
|
isGhes,
|
||||||
resetProjectDirectoriesMemoized
|
resetProjectDirectoriesMemoized
|
||||||
} from '../src/cache-utils';
|
} from '../src/cache-utils.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as cacheUtils from '../src/cache-utils';
|
import * as cacheUtils from '../src/cache-utils.js';
|
||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
import {Globber} from '@actions/glob';
|
import {Globber} from '@actions/glob';
|
||||||
import {MockGlobber} from './mock/glob-mock';
|
import {MockGlobber} from './mock/glob-mock.js';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
describe('cache-utils', () => {
|
describe('cache-utils', () => {
|
||||||
const versionYarn1 = '1.2.3';
|
const versionYarn1 = '1.2.3';
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import fs from 'fs';
|
|||||||
import cp from 'child_process';
|
import cp from 'child_process';
|
||||||
import osm from 'os';
|
import osm from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as main from '../src/main';
|
import * as main from '../src/main.js';
|
||||||
import * as auth from '../src/authutil';
|
import * as auth from '../src/authutil.js';
|
||||||
import {INodeVersion} from '../src/distributions/base-models';
|
import {INodeVersion} from '../src/distributions/base-models.js';
|
||||||
|
|
||||||
import nodeTestManifest from './data/versions-manifest.json';
|
import nodeTestManifest from './data/versions-manifest.json';
|
||||||
import nodeTestDist from './data/node-dist-index.json';
|
import nodeTestDist from './data/node-dist-index.json';
|
||||||
|
|||||||
@@ -7,37 +7,42 @@ import * as io from '@actions/io';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import osm from 'os';
|
import osm from 'os';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
import {jest, describe, beforeEach, afterEach, it, expect} from '@jest/globals';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
import each from 'jest-each';
|
import each from 'jest-each';
|
||||||
|
|
||||||
import * as main from '../src/main';
|
import * as main from '../src/main.js';
|
||||||
import * as util from '../src/util';
|
import * as util from '../src/util.js';
|
||||||
import OfficialBuilds from '../src/distributions/official_builds/official_builds';
|
import OfficialBuilds from '../src/distributions/official_builds/official_builds.js';
|
||||||
|
|
||||||
describe('main tests', () => {
|
describe('main tests', () => {
|
||||||
let inputs = {} as any;
|
let inputs = {} as any;
|
||||||
let os = {} as any;
|
let os = {} as any;
|
||||||
|
|
||||||
let infoSpy: jest.SpyInstance;
|
let infoSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let warningSpy: jest.SpyInstance;
|
let warningSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let saveStateSpy: jest.SpyInstance;
|
let saveStateSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let inSpy: jest.SpyInstance;
|
let inSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let setOutputSpy: jest.SpyInstance;
|
let setOutputSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let startGroupSpy: jest.SpyInstance;
|
let startGroupSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let endGroupSpy: jest.SpyInstance;
|
let endGroupSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let whichSpy: jest.SpyInstance;
|
let whichSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let existsSpy: jest.SpyInstance;
|
let existsSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let getExecOutputSpy: jest.SpyInstance;
|
let getExecOutputSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let getNodeVersionFromFileSpy: jest.SpyInstance;
|
let getNodeVersionFromFileSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let cnSpy: jest.SpyInstance;
|
let cnSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let findSpy: jest.SpyInstance;
|
let findSpy: ReturnType<typeof jest.spyOn>;
|
||||||
let isCacheActionAvailable: jest.SpyInstance;
|
let isCacheActionAvailable: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
let setupNodeJsSpy: jest.SpyInstance;
|
let setupNodeJsSpy: ReturnType<typeof jest.spyOn>;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
inputs = {};
|
inputs = {};
|
||||||
@@ -285,34 +290,124 @@ describe('main tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('cache feature tests', () => {
|
describe('cache feature tests', () => {
|
||||||
it('Should enable caching with the resolved package manager from packageManager field in package.json when the cache input is not provided', async () => {
|
it('Should enable caching when packageManager is npm and cache input is not provided', async () => {
|
||||||
inputs['package-manager-cache'] = 'true';
|
inputs['package-manager-cache'] = 'true';
|
||||||
inputs['cache'] = ''; // No cache input is provided
|
inputs['cache'] = '';
|
||||||
|
isCacheActionAvailable.mockImplementation(() => true);
|
||||||
|
|
||||||
inSpy.mockImplementation(name => inputs[name]);
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
|
||||||
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
||||||
readFileSpy.mockImplementation(() =>
|
readFileSpy.mockImplementation(() =>
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
packageManager: 'yarn@3.2.0'
|
packageManager: 'npm@10.8.2'
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
await main.run();
|
await main.run();
|
||||||
|
|
||||||
expect(saveStateSpy).toHaveBeenCalledWith(expect.anything(), 'yarn');
|
expect(saveStateSpy).toHaveBeenCalledWith(expect.anything(), 'npm');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should not enable caching if the packageManager field is missing in package.json and the cache input is not provided', async () => {
|
it('Should enable caching when devEngines.packageManager.name is "npm" and cache input is not provided', async () => {
|
||||||
inputs['package-manager-cache'] = 'true';
|
inputs['package-manager-cache'] = 'true';
|
||||||
inputs['cache'] = ''; // No cache input is provided
|
inputs['cache'] = '';
|
||||||
|
isCacheActionAvailable.mockImplementation(() => true);
|
||||||
|
|
||||||
inSpy.mockImplementation(name => inputs[name]);
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
|
||||||
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
||||||
readFileSpy.mockImplementation(() =>
|
readFileSpy.mockImplementation(() =>
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
//packageManager field is not present
|
devEngines: {
|
||||||
|
packageManager: {name: 'npm'}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
expect(saveStateSpy).toHaveBeenCalledWith(expect.anything(), 'npm');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should enable caching when devEngines.packageManager is array and one entry has name "npm"', async () => {
|
||||||
|
inputs['package-manager-cache'] = 'true';
|
||||||
|
inputs['cache'] = '';
|
||||||
|
isCacheActionAvailable.mockImplementation(() => true);
|
||||||
|
|
||||||
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
||||||
|
readFileSpy.mockImplementation(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
devEngines: {
|
||||||
|
packageManager: [{name: 'pnpm'}, {name: 'npm'}]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
expect(saveStateSpy).toHaveBeenCalledWith(expect.anything(), 'npm');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not enable caching if packageManager is "pnpm@8.0.0" and cache input is not provided', async () => {
|
||||||
|
inputs['package-manager-cache'] = 'true';
|
||||||
|
inputs['cache'] = '';
|
||||||
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
||||||
|
readFileSpy.mockImplementation(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
packageManager: 'pnpm@8.0.0'
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
expect(saveStateSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not enable caching if devEngines.packageManager.name is "pnpm"', async () => {
|
||||||
|
inputs['package-manager-cache'] = 'true';
|
||||||
|
inputs['cache'] = '';
|
||||||
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
||||||
|
readFileSpy.mockImplementation(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
devEngines: {
|
||||||
|
packageManager: {name: 'pnpm'}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
expect(saveStateSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not enable caching if devEngines.packageManager is array without "npm"', async () => {
|
||||||
|
inputs['package-manager-cache'] = 'true';
|
||||||
|
inputs['cache'] = '';
|
||||||
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
||||||
|
readFileSpy.mockImplementation(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
devEngines: {
|
||||||
|
packageManager: [{name: 'pnpm'}, {name: 'yarn'}]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
await main.run();
|
||||||
|
|
||||||
|
expect(saveStateSpy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should not enable caching if packageManager field is missing in package.json and cache input is not provided', async () => {
|
||||||
|
inputs['package-manager-cache'] = 'true';
|
||||||
|
inputs['cache'] = '';
|
||||||
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
const readFileSpy = jest.spyOn(fs, 'readFileSync');
|
||||||
|
readFileSpy.mockImplementation(() =>
|
||||||
|
JSON.stringify({
|
||||||
|
// packageManager field is not present
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -323,24 +418,18 @@ describe('main tests', () => {
|
|||||||
|
|
||||||
it('Should skip caching when package-manager-cache is false', async () => {
|
it('Should skip caching when package-manager-cache is false', async () => {
|
||||||
inputs['package-manager-cache'] = 'false';
|
inputs['package-manager-cache'] = 'false';
|
||||||
inputs['cache'] = ''; // No cache input is provided
|
inputs['cache'] = '';
|
||||||
|
|
||||||
inSpy.mockImplementation(name => inputs[name]);
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
|
|
||||||
await main.run();
|
await main.run();
|
||||||
|
|
||||||
expect(saveStateSpy).not.toHaveBeenCalled();
|
expect(saveStateSpy).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should enable caching with cache input explicitly provided', async () => {
|
it('Should enable caching with cache input explicitly provided', async () => {
|
||||||
inputs['package-manager-cache'] = 'true';
|
inputs['package-manager-cache'] = 'true';
|
||||||
inputs['cache'] = 'npm'; // Explicit cache input provided
|
inputs['cache'] = 'npm';
|
||||||
|
|
||||||
inSpy.mockImplementation(name => inputs[name]);
|
inSpy.mockImplementation(name => inputs[name]);
|
||||||
isCacheActionAvailable.mockReturnValue(true);
|
isCacheActionAvailable.mockImplementation(() => true);
|
||||||
|
|
||||||
await main.run();
|
await main.run();
|
||||||
|
|
||||||
expect(saveStateSpy).toHaveBeenCalledWith(expect.anything(), 'npm');
|
expect(saveStateSpy).toHaveBeenCalledWith(expect.anything(), 'npm');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {MockGlobber} from './glob-mock';
|
import {MockGlobber} from './glob-mock.js';
|
||||||
|
|
||||||
describe('mocked globber tests', () => {
|
describe('mocked globber tests', () => {
|
||||||
it('globber should return generator', async () => {
|
it('globber should return generator', async () => {
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import fs from 'fs';
|
|||||||
import cp from 'child_process';
|
import cp from 'child_process';
|
||||||
import osm from 'os';
|
import osm from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as main from '../src/main';
|
import * as main from '../src/main.js';
|
||||||
import * as auth from '../src/authutil';
|
import * as auth from '../src/authutil.js';
|
||||||
import {INodeVersion} from '../src/distributions/base-models';
|
import {INodeVersion} from '../src/distributions/base-models.js';
|
||||||
|
|
||||||
import nodeTestManifest from './data/versions-manifest.json';
|
import nodeTestManifest from './data/versions-manifest.json';
|
||||||
import nodeTestDist from './data/node-dist-index.json';
|
import nodeTestDist from './data/node-dist-index.json';
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import fs from 'fs';
|
|||||||
import cp from 'child_process';
|
import cp from 'child_process';
|
||||||
import osm from 'os';
|
import osm from 'os';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as main from '../src/main';
|
import * as main from '../src/main.js';
|
||||||
import * as auth from '../src/authutil';
|
import * as auth from '../src/authutil.js';
|
||||||
import {INodeVersion} from '../src/distributions/base-models';
|
import {INodeVersion} from '../src/distributions/base-models.js';
|
||||||
|
|
||||||
import nodeTestDist from './data/node-dist-index.json';
|
import nodeTestDist from './data/node-dist-index.json';
|
||||||
import nodeTestDistNightly from './data/node-nightly-index.json';
|
import nodeTestDistNightly from './data/node-nightly-index.json';
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ inputs:
|
|||||||
cache:
|
cache:
|
||||||
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
|
description: 'Used to specify a package manager for caching in the default directory. Supported values: npm, yarn, pnpm.'
|
||||||
package-manager-cache:
|
package-manager-cache:
|
||||||
description: 'Set to false to disable automatic caching based on the package manager field in package.json. By default, caching is enabled if the package manager field is present.'
|
description: 'Set to false to disable automatic caching. By default, caching is enabled when either devEngines.packageManager or the top-level packageManager field in package.json specifies npm as the package manager.'
|
||||||
default: true
|
default: true
|
||||||
cache-dependency-path:
|
cache-dependency-path:
|
||||||
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'
|
description: 'Used to specify the path to a dependency file: package-lock.json, yarn.lock, etc. Supports wildcards or a list of file names for caching multiple dependencies.'
|
||||||
|
|||||||
449
dist/cache-save/101.index.js
vendored
Normal file
449
dist/cache-save/101.index.js
vendored
Normal file
@@ -0,0 +1,449 @@
|
|||||||
|
export const id = 101;
|
||||||
|
export const ids = [101];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 9101:
|
||||||
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ toFormData: () => (/* binding */ toFormData)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9802);
|
||||||
|
/* harmony import */ var formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3018);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let s = 0;
|
||||||
|
const S = {
|
||||||
|
START_BOUNDARY: s++,
|
||||||
|
HEADER_FIELD_START: s++,
|
||||||
|
HEADER_FIELD: s++,
|
||||||
|
HEADER_VALUE_START: s++,
|
||||||
|
HEADER_VALUE: s++,
|
||||||
|
HEADER_VALUE_ALMOST_DONE: s++,
|
||||||
|
HEADERS_ALMOST_DONE: s++,
|
||||||
|
PART_DATA_START: s++,
|
||||||
|
PART_DATA: s++,
|
||||||
|
END: s++
|
||||||
|
};
|
||||||
|
|
||||||
|
let f = 1;
|
||||||
|
const F = {
|
||||||
|
PART_BOUNDARY: f,
|
||||||
|
LAST_BOUNDARY: f *= 2
|
||||||
|
};
|
||||||
|
|
||||||
|
const LF = 10;
|
||||||
|
const CR = 13;
|
||||||
|
const SPACE = 32;
|
||||||
|
const HYPHEN = 45;
|
||||||
|
const COLON = 58;
|
||||||
|
const A = 97;
|
||||||
|
const Z = 122;
|
||||||
|
|
||||||
|
const lower = c => c | 0x20;
|
||||||
|
|
||||||
|
const noop = () => {};
|
||||||
|
|
||||||
|
class MultipartParser {
|
||||||
|
/**
|
||||||
|
* @param {string} boundary
|
||||||
|
*/
|
||||||
|
constructor(boundary) {
|
||||||
|
this.index = 0;
|
||||||
|
this.flags = 0;
|
||||||
|
|
||||||
|
this.onHeaderEnd = noop;
|
||||||
|
this.onHeaderField = noop;
|
||||||
|
this.onHeadersEnd = noop;
|
||||||
|
this.onHeaderValue = noop;
|
||||||
|
this.onPartBegin = noop;
|
||||||
|
this.onPartData = noop;
|
||||||
|
this.onPartEnd = noop;
|
||||||
|
|
||||||
|
this.boundaryChars = {};
|
||||||
|
|
||||||
|
boundary = '\r\n--' + boundary;
|
||||||
|
const ui8a = new Uint8Array(boundary.length);
|
||||||
|
for (let i = 0; i < boundary.length; i++) {
|
||||||
|
ui8a[i] = boundary.charCodeAt(i);
|
||||||
|
this.boundaryChars[ui8a[i]] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.boundary = ui8a;
|
||||||
|
this.lookbehind = new Uint8Array(this.boundary.length + 8);
|
||||||
|
this.state = S.START_BOUNDARY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Uint8Array} data
|
||||||
|
*/
|
||||||
|
write(data) {
|
||||||
|
let i = 0;
|
||||||
|
const length_ = data.length;
|
||||||
|
let previousIndex = this.index;
|
||||||
|
let {lookbehind, boundary, boundaryChars, index, state, flags} = this;
|
||||||
|
const boundaryLength = this.boundary.length;
|
||||||
|
const boundaryEnd = boundaryLength - 1;
|
||||||
|
const bufferLength = data.length;
|
||||||
|
let c;
|
||||||
|
let cl;
|
||||||
|
|
||||||
|
const mark = name => {
|
||||||
|
this[name + 'Mark'] = i;
|
||||||
|
};
|
||||||
|
|
||||||
|
const clear = name => {
|
||||||
|
delete this[name + 'Mark'];
|
||||||
|
};
|
||||||
|
|
||||||
|
const callback = (callbackSymbol, start, end, ui8a) => {
|
||||||
|
if (start === undefined || start !== end) {
|
||||||
|
this[callbackSymbol](ui8a && ui8a.subarray(start, end));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const dataCallback = (name, clear) => {
|
||||||
|
const markSymbol = name + 'Mark';
|
||||||
|
if (!(markSymbol in this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clear) {
|
||||||
|
callback(name, this[markSymbol], i, data);
|
||||||
|
delete this[markSymbol];
|
||||||
|
} else {
|
||||||
|
callback(name, this[markSymbol], data.length, data);
|
||||||
|
this[markSymbol] = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < length_; i++) {
|
||||||
|
c = data[i];
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case S.START_BOUNDARY:
|
||||||
|
if (index === boundary.length - 2) {
|
||||||
|
if (c === HYPHEN) {
|
||||||
|
flags |= F.LAST_BOUNDARY;
|
||||||
|
} else if (c !== CR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
break;
|
||||||
|
} else if (index - 1 === boundary.length - 2) {
|
||||||
|
if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
|
||||||
|
state = S.END;
|
||||||
|
flags = 0;
|
||||||
|
} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
|
||||||
|
index = 0;
|
||||||
|
callback('onPartBegin');
|
||||||
|
state = S.HEADER_FIELD_START;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c !== boundary[index + 2]) {
|
||||||
|
index = -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c === boundary[index + 2]) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.HEADER_FIELD_START:
|
||||||
|
state = S.HEADER_FIELD;
|
||||||
|
mark('onHeaderField');
|
||||||
|
index = 0;
|
||||||
|
// falls through
|
||||||
|
case S.HEADER_FIELD:
|
||||||
|
if (c === CR) {
|
||||||
|
clear('onHeaderField');
|
||||||
|
state = S.HEADERS_ALMOST_DONE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
if (c === HYPHEN) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c === COLON) {
|
||||||
|
if (index === 1) {
|
||||||
|
// empty header field
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataCallback('onHeaderField', true);
|
||||||
|
state = S.HEADER_VALUE_START;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cl = lower(c);
|
||||||
|
if (cl < A || cl > Z) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.HEADER_VALUE_START:
|
||||||
|
if (c === SPACE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mark('onHeaderValue');
|
||||||
|
state = S.HEADER_VALUE;
|
||||||
|
// falls through
|
||||||
|
case S.HEADER_VALUE:
|
||||||
|
if (c === CR) {
|
||||||
|
dataCallback('onHeaderValue', true);
|
||||||
|
callback('onHeaderEnd');
|
||||||
|
state = S.HEADER_VALUE_ALMOST_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.HEADER_VALUE_ALMOST_DONE:
|
||||||
|
if (c !== LF) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = S.HEADER_FIELD_START;
|
||||||
|
break;
|
||||||
|
case S.HEADERS_ALMOST_DONE:
|
||||||
|
if (c !== LF) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback('onHeadersEnd');
|
||||||
|
state = S.PART_DATA_START;
|
||||||
|
break;
|
||||||
|
case S.PART_DATA_START:
|
||||||
|
state = S.PART_DATA;
|
||||||
|
mark('onPartData');
|
||||||
|
// falls through
|
||||||
|
case S.PART_DATA:
|
||||||
|
previousIndex = index;
|
||||||
|
|
||||||
|
if (index === 0) {
|
||||||
|
// boyer-moore derrived algorithm to safely skip non-boundary data
|
||||||
|
i += boundaryEnd;
|
||||||
|
while (i < bufferLength && !(data[i] in boundaryChars)) {
|
||||||
|
i += boundaryLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
i -= boundaryEnd;
|
||||||
|
c = data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < boundary.length) {
|
||||||
|
if (boundary[index] === c) {
|
||||||
|
if (index === 0) {
|
||||||
|
dataCallback('onPartData', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
} else if (index === boundary.length) {
|
||||||
|
index++;
|
||||||
|
if (c === CR) {
|
||||||
|
// CR = part boundary
|
||||||
|
flags |= F.PART_BOUNDARY;
|
||||||
|
} else if (c === HYPHEN) {
|
||||||
|
// HYPHEN = end boundary
|
||||||
|
flags |= F.LAST_BOUNDARY;
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
} else if (index - 1 === boundary.length) {
|
||||||
|
if (flags & F.PART_BOUNDARY) {
|
||||||
|
index = 0;
|
||||||
|
if (c === LF) {
|
||||||
|
// unset the PART_BOUNDARY flag
|
||||||
|
flags &= ~F.PART_BOUNDARY;
|
||||||
|
callback('onPartEnd');
|
||||||
|
callback('onPartBegin');
|
||||||
|
state = S.HEADER_FIELD_START;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (flags & F.LAST_BOUNDARY) {
|
||||||
|
if (c === HYPHEN) {
|
||||||
|
callback('onPartEnd');
|
||||||
|
state = S.END;
|
||||||
|
flags = 0;
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index > 0) {
|
||||||
|
// when matching a possible boundary, keep a lookbehind reference
|
||||||
|
// in case it turns out to be a false lead
|
||||||
|
lookbehind[index - 1] = c;
|
||||||
|
} else if (previousIndex > 0) {
|
||||||
|
// if our boundary turned out to be rubbish, the captured lookbehind
|
||||||
|
// belongs to partData
|
||||||
|
const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
|
||||||
|
callback('onPartData', 0, previousIndex, _lookbehind);
|
||||||
|
previousIndex = 0;
|
||||||
|
mark('onPartData');
|
||||||
|
|
||||||
|
// reconsider the current character even so it interrupted the sequence
|
||||||
|
// it could be the beginning of a new sequence
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.END:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(`Unexpected state entered: ${state}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dataCallback('onHeaderField');
|
||||||
|
dataCallback('onHeaderValue');
|
||||||
|
dataCallback('onPartData');
|
||||||
|
|
||||||
|
// Update properties for the next call
|
||||||
|
this.index = index;
|
||||||
|
this.state = state;
|
||||||
|
this.flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
end() {
|
||||||
|
if ((this.state === S.HEADER_FIELD_START && this.index === 0) ||
|
||||||
|
(this.state === S.PART_DATA && this.index === this.boundary.length)) {
|
||||||
|
this.onPartEnd();
|
||||||
|
} else if (this.state !== S.END) {
|
||||||
|
throw new Error('MultipartParser.end(): stream ended unexpectedly');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fileName(headerValue) {
|
||||||
|
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||||
|
const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
||||||
|
if (!m) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const match = m[2] || m[3] || '';
|
||||||
|
let filename = match.slice(match.lastIndexOf('\\') + 1);
|
||||||
|
filename = filename.replace(/%22/g, '"');
|
||||||
|
filename = filename.replace(/&#(\d{4});/g, (m, code) => {
|
||||||
|
return String.fromCharCode(code);
|
||||||
|
});
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toFormData(Body, ct) {
|
||||||
|
if (!/multipart/i.test(ct)) {
|
||||||
|
throw new TypeError('Failed to fetch');
|
||||||
|
}
|
||||||
|
|
||||||
|
const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
||||||
|
|
||||||
|
if (!m) {
|
||||||
|
throw new TypeError('no or bad content-type header, no multipart boundary');
|
||||||
|
}
|
||||||
|
|
||||||
|
const parser = new MultipartParser(m[1] || m[2]);
|
||||||
|
|
||||||
|
let headerField;
|
||||||
|
let headerValue;
|
||||||
|
let entryValue;
|
||||||
|
let entryName;
|
||||||
|
let contentType;
|
||||||
|
let filename;
|
||||||
|
const entryChunks = [];
|
||||||
|
const formData = new formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__/* .FormData */ .fS();
|
||||||
|
|
||||||
|
const onPartData = ui8a => {
|
||||||
|
entryValue += decoder.decode(ui8a, {stream: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
const appendToFile = ui8a => {
|
||||||
|
entryChunks.push(ui8a);
|
||||||
|
};
|
||||||
|
|
||||||
|
const appendFileToFormData = () => {
|
||||||
|
const file = new fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__/* .File */ .ZH(entryChunks, filename, {type: contentType});
|
||||||
|
formData.append(entryName, file);
|
||||||
|
};
|
||||||
|
|
||||||
|
const appendEntryToFormData = () => {
|
||||||
|
formData.append(entryName, entryValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const decoder = new TextDecoder('utf-8');
|
||||||
|
decoder.decode();
|
||||||
|
|
||||||
|
parser.onPartBegin = function () {
|
||||||
|
parser.onPartData = onPartData;
|
||||||
|
parser.onPartEnd = appendEntryToFormData;
|
||||||
|
|
||||||
|
headerField = '';
|
||||||
|
headerValue = '';
|
||||||
|
entryValue = '';
|
||||||
|
entryName = '';
|
||||||
|
contentType = '';
|
||||||
|
filename = null;
|
||||||
|
entryChunks.length = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onHeaderField = function (ui8a) {
|
||||||
|
headerField += decoder.decode(ui8a, {stream: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onHeaderValue = function (ui8a) {
|
||||||
|
headerValue += decoder.decode(ui8a, {stream: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onHeaderEnd = function () {
|
||||||
|
headerValue += decoder.decode();
|
||||||
|
headerField = headerField.toLowerCase();
|
||||||
|
|
||||||
|
if (headerField === 'content-disposition') {
|
||||||
|
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||||
|
const m = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
||||||
|
|
||||||
|
if (m) {
|
||||||
|
entryName = m[2] || m[3] || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
filename = _fileName(headerValue);
|
||||||
|
|
||||||
|
if (filename) {
|
||||||
|
parser.onPartData = appendToFile;
|
||||||
|
parser.onPartEnd = appendFileToFormData;
|
||||||
|
}
|
||||||
|
} else if (headerField === 'content-type') {
|
||||||
|
contentType = headerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
headerValue = '';
|
||||||
|
headerField = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
for await (const chunk of Body) {
|
||||||
|
parser.write(chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.end();
|
||||||
|
|
||||||
|
return formData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
12843
dist/cache-save/index.js
vendored
12843
dist/cache-save/index.js
vendored
File diff suppressed because one or more lines are too long
3
dist/cache-save/package.json
vendored
Normal file
3
dist/cache-save/package.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
449
dist/setup/101.index.js
vendored
Normal file
449
dist/setup/101.index.js
vendored
Normal file
@@ -0,0 +1,449 @@
|
|||||||
|
export const id = 101;
|
||||||
|
export const ids = [101];
|
||||||
|
export const modules = {
|
||||||
|
|
||||||
|
/***/ 9101:
|
||||||
|
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
||||||
|
|
||||||
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
||||||
|
/* harmony export */ toFormData: () => (/* binding */ toFormData)
|
||||||
|
/* harmony export */ });
|
||||||
|
/* harmony import */ var fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9802);
|
||||||
|
/* harmony import */ var formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3018);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let s = 0;
|
||||||
|
const S = {
|
||||||
|
START_BOUNDARY: s++,
|
||||||
|
HEADER_FIELD_START: s++,
|
||||||
|
HEADER_FIELD: s++,
|
||||||
|
HEADER_VALUE_START: s++,
|
||||||
|
HEADER_VALUE: s++,
|
||||||
|
HEADER_VALUE_ALMOST_DONE: s++,
|
||||||
|
HEADERS_ALMOST_DONE: s++,
|
||||||
|
PART_DATA_START: s++,
|
||||||
|
PART_DATA: s++,
|
||||||
|
END: s++
|
||||||
|
};
|
||||||
|
|
||||||
|
let f = 1;
|
||||||
|
const F = {
|
||||||
|
PART_BOUNDARY: f,
|
||||||
|
LAST_BOUNDARY: f *= 2
|
||||||
|
};
|
||||||
|
|
||||||
|
const LF = 10;
|
||||||
|
const CR = 13;
|
||||||
|
const SPACE = 32;
|
||||||
|
const HYPHEN = 45;
|
||||||
|
const COLON = 58;
|
||||||
|
const A = 97;
|
||||||
|
const Z = 122;
|
||||||
|
|
||||||
|
const lower = c => c | 0x20;
|
||||||
|
|
||||||
|
const noop = () => {};
|
||||||
|
|
||||||
|
class MultipartParser {
|
||||||
|
/**
|
||||||
|
* @param {string} boundary
|
||||||
|
*/
|
||||||
|
constructor(boundary) {
|
||||||
|
this.index = 0;
|
||||||
|
this.flags = 0;
|
||||||
|
|
||||||
|
this.onHeaderEnd = noop;
|
||||||
|
this.onHeaderField = noop;
|
||||||
|
this.onHeadersEnd = noop;
|
||||||
|
this.onHeaderValue = noop;
|
||||||
|
this.onPartBegin = noop;
|
||||||
|
this.onPartData = noop;
|
||||||
|
this.onPartEnd = noop;
|
||||||
|
|
||||||
|
this.boundaryChars = {};
|
||||||
|
|
||||||
|
boundary = '\r\n--' + boundary;
|
||||||
|
const ui8a = new Uint8Array(boundary.length);
|
||||||
|
for (let i = 0; i < boundary.length; i++) {
|
||||||
|
ui8a[i] = boundary.charCodeAt(i);
|
||||||
|
this.boundaryChars[ui8a[i]] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.boundary = ui8a;
|
||||||
|
this.lookbehind = new Uint8Array(this.boundary.length + 8);
|
||||||
|
this.state = S.START_BOUNDARY;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Uint8Array} data
|
||||||
|
*/
|
||||||
|
write(data) {
|
||||||
|
let i = 0;
|
||||||
|
const length_ = data.length;
|
||||||
|
let previousIndex = this.index;
|
||||||
|
let {lookbehind, boundary, boundaryChars, index, state, flags} = this;
|
||||||
|
const boundaryLength = this.boundary.length;
|
||||||
|
const boundaryEnd = boundaryLength - 1;
|
||||||
|
const bufferLength = data.length;
|
||||||
|
let c;
|
||||||
|
let cl;
|
||||||
|
|
||||||
|
const mark = name => {
|
||||||
|
this[name + 'Mark'] = i;
|
||||||
|
};
|
||||||
|
|
||||||
|
const clear = name => {
|
||||||
|
delete this[name + 'Mark'];
|
||||||
|
};
|
||||||
|
|
||||||
|
const callback = (callbackSymbol, start, end, ui8a) => {
|
||||||
|
if (start === undefined || start !== end) {
|
||||||
|
this[callbackSymbol](ui8a && ui8a.subarray(start, end));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const dataCallback = (name, clear) => {
|
||||||
|
const markSymbol = name + 'Mark';
|
||||||
|
if (!(markSymbol in this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clear) {
|
||||||
|
callback(name, this[markSymbol], i, data);
|
||||||
|
delete this[markSymbol];
|
||||||
|
} else {
|
||||||
|
callback(name, this[markSymbol], data.length, data);
|
||||||
|
this[markSymbol] = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (i = 0; i < length_; i++) {
|
||||||
|
c = data[i];
|
||||||
|
|
||||||
|
switch (state) {
|
||||||
|
case S.START_BOUNDARY:
|
||||||
|
if (index === boundary.length - 2) {
|
||||||
|
if (c === HYPHEN) {
|
||||||
|
flags |= F.LAST_BOUNDARY;
|
||||||
|
} else if (c !== CR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
break;
|
||||||
|
} else if (index - 1 === boundary.length - 2) {
|
||||||
|
if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
|
||||||
|
state = S.END;
|
||||||
|
flags = 0;
|
||||||
|
} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
|
||||||
|
index = 0;
|
||||||
|
callback('onPartBegin');
|
||||||
|
state = S.HEADER_FIELD_START;
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c !== boundary[index + 2]) {
|
||||||
|
index = -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c === boundary[index + 2]) {
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.HEADER_FIELD_START:
|
||||||
|
state = S.HEADER_FIELD;
|
||||||
|
mark('onHeaderField');
|
||||||
|
index = 0;
|
||||||
|
// falls through
|
||||||
|
case S.HEADER_FIELD:
|
||||||
|
if (c === CR) {
|
||||||
|
clear('onHeaderField');
|
||||||
|
state = S.HEADERS_ALMOST_DONE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
if (c === HYPHEN) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c === COLON) {
|
||||||
|
if (index === 1) {
|
||||||
|
// empty header field
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dataCallback('onHeaderField', true);
|
||||||
|
state = S.HEADER_VALUE_START;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cl = lower(c);
|
||||||
|
if (cl < A || cl > Z) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.HEADER_VALUE_START:
|
||||||
|
if (c === SPACE) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mark('onHeaderValue');
|
||||||
|
state = S.HEADER_VALUE;
|
||||||
|
// falls through
|
||||||
|
case S.HEADER_VALUE:
|
||||||
|
if (c === CR) {
|
||||||
|
dataCallback('onHeaderValue', true);
|
||||||
|
callback('onHeaderEnd');
|
||||||
|
state = S.HEADER_VALUE_ALMOST_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.HEADER_VALUE_ALMOST_DONE:
|
||||||
|
if (c !== LF) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = S.HEADER_FIELD_START;
|
||||||
|
break;
|
||||||
|
case S.HEADERS_ALMOST_DONE:
|
||||||
|
if (c !== LF) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
callback('onHeadersEnd');
|
||||||
|
state = S.PART_DATA_START;
|
||||||
|
break;
|
||||||
|
case S.PART_DATA_START:
|
||||||
|
state = S.PART_DATA;
|
||||||
|
mark('onPartData');
|
||||||
|
// falls through
|
||||||
|
case S.PART_DATA:
|
||||||
|
previousIndex = index;
|
||||||
|
|
||||||
|
if (index === 0) {
|
||||||
|
// boyer-moore derrived algorithm to safely skip non-boundary data
|
||||||
|
i += boundaryEnd;
|
||||||
|
while (i < bufferLength && !(data[i] in boundaryChars)) {
|
||||||
|
i += boundaryLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
i -= boundaryEnd;
|
||||||
|
c = data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index < boundary.length) {
|
||||||
|
if (boundary[index] === c) {
|
||||||
|
if (index === 0) {
|
||||||
|
dataCallback('onPartData', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
index++;
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
} else if (index === boundary.length) {
|
||||||
|
index++;
|
||||||
|
if (c === CR) {
|
||||||
|
// CR = part boundary
|
||||||
|
flags |= F.PART_BOUNDARY;
|
||||||
|
} else if (c === HYPHEN) {
|
||||||
|
// HYPHEN = end boundary
|
||||||
|
flags |= F.LAST_BOUNDARY;
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
} else if (index - 1 === boundary.length) {
|
||||||
|
if (flags & F.PART_BOUNDARY) {
|
||||||
|
index = 0;
|
||||||
|
if (c === LF) {
|
||||||
|
// unset the PART_BOUNDARY flag
|
||||||
|
flags &= ~F.PART_BOUNDARY;
|
||||||
|
callback('onPartEnd');
|
||||||
|
callback('onPartBegin');
|
||||||
|
state = S.HEADER_FIELD_START;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else if (flags & F.LAST_BOUNDARY) {
|
||||||
|
if (c === HYPHEN) {
|
||||||
|
callback('onPartEnd');
|
||||||
|
state = S.END;
|
||||||
|
flags = 0;
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index > 0) {
|
||||||
|
// when matching a possible boundary, keep a lookbehind reference
|
||||||
|
// in case it turns out to be a false lead
|
||||||
|
lookbehind[index - 1] = c;
|
||||||
|
} else if (previousIndex > 0) {
|
||||||
|
// if our boundary turned out to be rubbish, the captured lookbehind
|
||||||
|
// belongs to partData
|
||||||
|
const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
|
||||||
|
callback('onPartData', 0, previousIndex, _lookbehind);
|
||||||
|
previousIndex = 0;
|
||||||
|
mark('onPartData');
|
||||||
|
|
||||||
|
// reconsider the current character even so it interrupted the sequence
|
||||||
|
// it could be the beginning of a new sequence
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case S.END:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw new Error(`Unexpected state entered: ${state}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dataCallback('onHeaderField');
|
||||||
|
dataCallback('onHeaderValue');
|
||||||
|
dataCallback('onPartData');
|
||||||
|
|
||||||
|
// Update properties for the next call
|
||||||
|
this.index = index;
|
||||||
|
this.state = state;
|
||||||
|
this.flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
end() {
|
||||||
|
if ((this.state === S.HEADER_FIELD_START && this.index === 0) ||
|
||||||
|
(this.state === S.PART_DATA && this.index === this.boundary.length)) {
|
||||||
|
this.onPartEnd();
|
||||||
|
} else if (this.state !== S.END) {
|
||||||
|
throw new Error('MultipartParser.end(): stream ended unexpectedly');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function _fileName(headerValue) {
|
||||||
|
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||||
|
const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
||||||
|
if (!m) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const match = m[2] || m[3] || '';
|
||||||
|
let filename = match.slice(match.lastIndexOf('\\') + 1);
|
||||||
|
filename = filename.replace(/%22/g, '"');
|
||||||
|
filename = filename.replace(/&#(\d{4});/g, (m, code) => {
|
||||||
|
return String.fromCharCode(code);
|
||||||
|
});
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toFormData(Body, ct) {
|
||||||
|
if (!/multipart/i.test(ct)) {
|
||||||
|
throw new TypeError('Failed to fetch');
|
||||||
|
}
|
||||||
|
|
||||||
|
const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
||||||
|
|
||||||
|
if (!m) {
|
||||||
|
throw new TypeError('no or bad content-type header, no multipart boundary');
|
||||||
|
}
|
||||||
|
|
||||||
|
const parser = new MultipartParser(m[1] || m[2]);
|
||||||
|
|
||||||
|
let headerField;
|
||||||
|
let headerValue;
|
||||||
|
let entryValue;
|
||||||
|
let entryName;
|
||||||
|
let contentType;
|
||||||
|
let filename;
|
||||||
|
const entryChunks = [];
|
||||||
|
const formData = new formdata_polyfill_esm_min_js__WEBPACK_IMPORTED_MODULE_1__/* .FormData */ .fS();
|
||||||
|
|
||||||
|
const onPartData = ui8a => {
|
||||||
|
entryValue += decoder.decode(ui8a, {stream: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
const appendToFile = ui8a => {
|
||||||
|
entryChunks.push(ui8a);
|
||||||
|
};
|
||||||
|
|
||||||
|
const appendFileToFormData = () => {
|
||||||
|
const file = new fetch_blob_from_js__WEBPACK_IMPORTED_MODULE_0__/* .File */ .ZH(entryChunks, filename, {type: contentType});
|
||||||
|
formData.append(entryName, file);
|
||||||
|
};
|
||||||
|
|
||||||
|
const appendEntryToFormData = () => {
|
||||||
|
formData.append(entryName, entryValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
const decoder = new TextDecoder('utf-8');
|
||||||
|
decoder.decode();
|
||||||
|
|
||||||
|
parser.onPartBegin = function () {
|
||||||
|
parser.onPartData = onPartData;
|
||||||
|
parser.onPartEnd = appendEntryToFormData;
|
||||||
|
|
||||||
|
headerField = '';
|
||||||
|
headerValue = '';
|
||||||
|
entryValue = '';
|
||||||
|
entryName = '';
|
||||||
|
contentType = '';
|
||||||
|
filename = null;
|
||||||
|
entryChunks.length = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onHeaderField = function (ui8a) {
|
||||||
|
headerField += decoder.decode(ui8a, {stream: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onHeaderValue = function (ui8a) {
|
||||||
|
headerValue += decoder.decode(ui8a, {stream: true});
|
||||||
|
};
|
||||||
|
|
||||||
|
parser.onHeaderEnd = function () {
|
||||||
|
headerValue += decoder.decode();
|
||||||
|
headerField = headerField.toLowerCase();
|
||||||
|
|
||||||
|
if (headerField === 'content-disposition') {
|
||||||
|
// matches either a quoted-string or a token (RFC 2616 section 19.5.1)
|
||||||
|
const m = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
||||||
|
|
||||||
|
if (m) {
|
||||||
|
entryName = m[2] || m[3] || '';
|
||||||
|
}
|
||||||
|
|
||||||
|
filename = _fileName(headerValue);
|
||||||
|
|
||||||
|
if (filename) {
|
||||||
|
parser.onPartData = appendToFile;
|
||||||
|
parser.onPartEnd = appendFileToFormData;
|
||||||
|
}
|
||||||
|
} else if (headerField === 'content-type') {
|
||||||
|
contentType = headerValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
headerValue = '';
|
||||||
|
headerField = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
for await (const chunk of Body) {
|
||||||
|
parser.write(chunk);
|
||||||
|
}
|
||||||
|
|
||||||
|
parser.end();
|
||||||
|
|
||||||
|
return formData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***/ })
|
||||||
|
|
||||||
|
};
|
||||||
BIN
dist/setup/7zr.exe
vendored
Normal file
BIN
dist/setup/7zr.exe
vendored
Normal file
Binary file not shown.
18350
dist/setup/index.js
vendored
18350
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
3
dist/setup/package.json
vendored
Normal file
3
dist/setup/package.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"type": "module"
|
||||||
|
}
|
||||||
@@ -46,9 +46,9 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: '24'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
@@ -64,7 +64,7 @@ See [supported version syntax](https://github.com/actions/setup-node#supported-v
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@@ -98,9 +98,9 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '24'
|
||||||
architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
|
architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
@@ -119,9 +119,9 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '20.0.0-v8-canary' # it will install the latest v8 canary release for node 20.0.0
|
node-version: '24.0.0-v8-canary' # it will install the latest v8 canary release for node 24.0.0
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -134,9 +134,9 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '20-v8-canary' # it will install the latest v8 canary release for node 20
|
node-version: '24-v8-canary' # it will install the latest v8 canary release for node 24
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -150,9 +150,9 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 'v20.1.1-v8-canary20221103f7e2421e91'
|
node-version: 'v24.0.0-v8-canary2025030537242e55ac'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -170,9 +170,9 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '16-nightly' # it will install the latest nightly release for node 16
|
node-version: '24-nightly' # it will install the latest nightly release for node 24
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -186,9 +186,9 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '16.0.0-nightly' # it will install the latest nightly release for node 16.0.0
|
node-version: '24.0.0-nightly' # it will install the latest nightly release for node 24.0.0
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -202,9 +202,9 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '16.0.0-nightly20210420a0261d231c'
|
node-version: '24.0.0-nightly202505066102159fa1'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -220,26 +220,27 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '16.0.0-rc.1'
|
node-version: '24.0.0-rc.4'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** Unlike nightly versions, which support version range specifiers, you must specify the exact version for a release candidate: `16.0.0-rc.1`.
|
**Note:** Unlike nightly versions, which support version range specifiers, you must specify the exact version for a release candidate: `24.0.0-rc.4`.
|
||||||
|
|
||||||
## Caching packages data
|
## Caching packages data
|
||||||
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
|
The action follows [actions/cache](https://github.com/actions/cache/blob/main/examples.md#node---npm) guidelines, and caches global cache on the machine instead of `node_modules`, so cache can be reused between different Node.js versions.
|
||||||
|
|
||||||
**Caching yarn dependencies:**
|
**Caching yarn dependencies:**
|
||||||
Yarn caching handles both yarn versions: 1 or 2.
|
Yarn caching handles both Yarn Classic (v1) and Yarn Berry (v2, v3, v4+).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '24'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --frozen-lockfile # optional, --immutable
|
- run: yarn install --frozen-lockfile # optional, --immutable
|
||||||
- run: yarn test
|
- run: yarn test
|
||||||
@@ -256,12 +257,12 @@ steps:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: pnpm/action-setup@v2
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 6.32.9
|
version: 10
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '24'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
- run: pnpm install
|
- run: pnpm install
|
||||||
- run: pnpm test
|
- run: pnpm test
|
||||||
@@ -275,9 +276,9 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '24'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@@ -288,9 +289,9 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14'
|
node-version: '24'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
server/app/package-lock.json
|
server/app/package-lock.json
|
||||||
@@ -299,6 +300,35 @@ steps:
|
|||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Restore-Only Cache**
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
## In some workflows, you may want to restore a cache without saving it. This can help reduce cache writes and storage usage in workflows that only need to read from cache
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v5
|
||||||
|
# Restore Node.js modules cache (restore-only)
|
||||||
|
- name: Restore Node modules cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-node-modules
|
||||||
|
with:
|
||||||
|
path: ~/.npm
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
# Setup Node.js
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: '24'
|
||||||
|
# Install dependencies
|
||||||
|
- run: npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
> For more details related to cache scenarios, please refer [Node – npm](https://github.com/actions/cache/blob/main/examples.md#node---npm).
|
||||||
|
|
||||||
## Multiple Operating Systems and Architectures
|
## Multiple Operating Systems and Architectures
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -312,21 +342,21 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
node_version:
|
node_version:
|
||||||
- 12
|
- 20
|
||||||
- 14
|
- 22
|
||||||
- 16
|
- 24
|
||||||
architecture:
|
architecture:
|
||||||
- x64
|
- x64
|
||||||
# an extra windows-x86 run:
|
# an extra windows-x86 run:
|
||||||
include:
|
include:
|
||||||
- os: windows-2016
|
- os: windows-latest
|
||||||
node_version: 12
|
node_version: 24
|
||||||
architecture: x86
|
architecture: x86
|
||||||
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
@@ -338,15 +368,15 @@ jobs:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '24.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm publish
|
- run: npm publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://npm.pkg.github.com'
|
registry-url: 'https://npm.pkg.github.com'
|
||||||
- run: npm publish
|
- run: npm publish
|
||||||
@@ -358,15 +388,15 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '24.x'
|
||||||
registry-url: <registry url>
|
registry-url: <registry url>
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn publish
|
- run: yarn publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://npm.pkg.github.com'
|
registry-url: 'https://npm.pkg.github.com'
|
||||||
- run: yarn publish
|
- run: yarn publish
|
||||||
@@ -378,9 +408,9 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '24.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
# Skip post-install scripts here, as a malicious
|
# Skip post-install scripts here, as a malicious
|
||||||
# script could steal NODE_AUTH_TOKEN.
|
# script could steal NODE_AUTH_TOKEN.
|
||||||
@@ -398,9 +428,9 @@ Below you can find a sample "Setup .yarnrc.yml" step, that is going to allow you
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '24.x'
|
||||||
- name: Setup .yarnrc.yml
|
- name: Setup .yarnrc.yml
|
||||||
run: |
|
run: |
|
||||||
yarn config set npmScopes.my-org.npmRegistryServer "https://npm.pkg.github.com"
|
yarn config set npmScopes.my-org.npmRegistryServer "https://npm.pkg.github.com"
|
||||||
@@ -427,9 +457,9 @@ It is possible to specify a token to authenticate with the mirror using the `mir
|
|||||||
The token will be passed as a bearer token in the `Authorization` header.
|
The token will be passed as a bearer token in the `Authorization` header.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '14.x'
|
node-version: '24.x'
|
||||||
mirror: 'https://nodejs.org/dist'
|
mirror: 'https://nodejs.org/dist'
|
||||||
mirror-token: 'your-mirror-token'
|
mirror-token: 'your-mirror-token'
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
module.exports = {
|
export default {
|
||||||
clearMocks: true,
|
clearMocks: true,
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
moduleFileExtensions: ['js', 'ts'],
|
||||||
testEnvironment: 'node',
|
testEnvironment: 'node',
|
||||||
testMatch: ['**/*.test.ts'],
|
testMatch: ['**/*.test.ts'],
|
||||||
testRunner: 'jest-circus/runner',
|
testRunner: 'jest-circus/runner',
|
||||||
|
extensionsToTreatAsEsm: ['.ts'],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.ts$': 'ts-jest'
|
'^.+\\.ts$': ['ts-jest', {
|
||||||
|
useESM: true,
|
||||||
|
tsconfig: {
|
||||||
|
module: 'es2022',
|
||||||
|
target: 'es2022'
|
||||||
|
}
|
||||||
|
}]
|
||||||
},
|
},
|
||||||
|
preset: 'ts-jest/presets/default-esm',
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^(\\.{1,2}/.*)\\.js$': '$1'
|
||||||
|
},
|
||||||
|
transformIgnorePatterns: [
|
||||||
|
'node_modules/(?!(node-fetch|fetch-blob|formdata-polyfill|data-uri-to-buffer)/)'
|
||||||
|
],
|
||||||
verbose: true
|
verbose: true
|
||||||
}
|
}
|
||||||
1435
package-lock.json
generated
1435
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -1,7 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-node",
|
"name": "setup-node",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
"description": "setup node action",
|
"description": "setup node action",
|
||||||
"main": "lib/setup-node.js",
|
"main": "lib/setup-node.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
@@ -11,9 +12,9 @@
|
|||||||
"build": "ncc build -o dist/setup src/setup-node.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
"build": "ncc build -o dist/setup src/setup-node.ts && ncc build -o dist/cache-save src/cache-save.ts",
|
||||||
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
|
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
|
||||||
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
|
"format-check": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --check \"**/*.{ts,yml,yaml}\"",
|
||||||
"lint": "eslint --config ./.eslintrc.js \"**/*.ts\"",
|
"lint": "eslint --config ./.eslintrc.cjs \"**/*.ts\"",
|
||||||
"lint:fix": "eslint --config ./.eslintrc.js \"**/*.ts\" --fix",
|
"lint:fix": "eslint --config ./.eslintrc.cjs \"**/*.ts\" --fix",
|
||||||
"test": "jest --coverage",
|
"test": "node --experimental-vm-modules node_modules/.bin/jest --coverage",
|
||||||
"pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
|
"pre-checkin": "npm run format && npm run lint:fix && npm run build && npm test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
"uuid": "^11.1.0"
|
"uuid": "^11.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@jest/globals": "^30.2.0",
|
||||||
"@types/jest": "^29.5.14",
|
"@types/jest": "^29.5.14",
|
||||||
"@types/node": "^24.1.0",
|
"@types/node": "^24.1.0",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
@@ -53,8 +55,11 @@
|
|||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^29.7.0",
|
||||||
"jest-each": "^29.7.0",
|
"jest-each": "^29.7.0",
|
||||||
"prettier": "^2.8.4",
|
"prettier": "^3.6.2",
|
||||||
"ts-jest": "^29.1.2",
|
"ts-jest": "^29.4.1",
|
||||||
"typescript": "^5.4.2"
|
"typescript": "^5.4.2"
|
||||||
|
},
|
||||||
|
"overrides": {
|
||||||
|
"node-fetch": "^3.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ import path from 'path';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import {State} from './constants';
|
import {State} from './constants.js';
|
||||||
import {
|
import {
|
||||||
getCacheDirectories,
|
getCacheDirectories,
|
||||||
getPackageManagerInfo,
|
getPackageManagerInfo,
|
||||||
repoHasYarnBerryManagedDependencies,
|
repoHasYarnBerryManagedDependencies,
|
||||||
PackageManagerInfo
|
PackageManagerInfo
|
||||||
} from './cache-utils';
|
} from './cache-utils.js';
|
||||||
|
|
||||||
export const restoreCache = async (
|
export const restoreCache = async (
|
||||||
packageManager: string,
|
packageManager: string,
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as cache from '@actions/cache';
|
import * as cache from '@actions/cache';
|
||||||
|
|
||||||
import {State} from './constants';
|
import {State} from './constants.js';
|
||||||
import {getPackageManagerInfo} from './cache-utils';
|
import {getPackageManagerInfo} from './cache-utils.js';
|
||||||
|
|
||||||
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
// Catch and log any unhandled exceptions. These exceptions can leak out of the uploadChunk method in
|
||||||
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
// @actions/toolkit when a failed upload closes the file descriptor causing any in-process reads to
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import * as cache from '@actions/cache';
|
|||||||
import * as glob from '@actions/glob';
|
import * as glob from '@actions/glob';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import {unique} from './util';
|
import {unique} from './util.js';
|
||||||
|
|
||||||
export interface PackageManagerInfo {
|
export interface PackageManagerInfo {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -167,14 +167,12 @@ const getCacheDirectoriesFromCacheDependencyPath = async (
|
|||||||
packageManagerInfo: PackageManagerInfo,
|
packageManagerInfo: PackageManagerInfo,
|
||||||
cacheDependencyPath: string
|
cacheDependencyPath: string
|
||||||
): Promise<string[]> => {
|
): Promise<string[]> => {
|
||||||
const projectDirectories = await getProjectDirectoriesFromCacheDependencyPath(
|
const projectDirectories =
|
||||||
cacheDependencyPath
|
await getProjectDirectoriesFromCacheDependencyPath(cacheDependencyPath);
|
||||||
);
|
|
||||||
const cacheFoldersPaths = await Promise.all(
|
const cacheFoldersPaths = await Promise.all(
|
||||||
projectDirectories.map(async projectDirectory => {
|
projectDirectories.map(async projectDirectory => {
|
||||||
const cacheFolderPath = await packageManagerInfo.getCacheFolderPath(
|
const cacheFolderPath =
|
||||||
projectDirectory
|
await packageManagerInfo.getCacheFolderPath(projectDirectory);
|
||||||
);
|
|
||||||
core.debug(
|
core.debug(
|
||||||
`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`
|
`${packageManagerInfo.name}'s cache folder "${cacheFolderPath}" configured for the directory "${projectDirectory}"`
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import * as tc from '@actions/tool-cache';
|
|||||||
|
|
||||||
import semver from 'semver';
|
import semver from 'semver';
|
||||||
|
|
||||||
import BaseDistribution from './base-distribution';
|
import BaseDistribution from './base-distribution.js';
|
||||||
import {NodeInputs} from './base-models';
|
import {NodeInputs} from './base-models.js';
|
||||||
|
|
||||||
export default abstract class BasePrereleaseNodejs extends BaseDistribution {
|
export default abstract class BasePrereleaseNodejs extends BaseDistribution {
|
||||||
protected abstract distribution: string;
|
protected abstract distribution: string;
|
||||||
|
|||||||
@@ -10,8 +10,12 @@ import * as assert from 'assert';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
import {NodeInputs, INodeVersion, INodeVersionInfo} from './base-models';
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
import {NodeInputs, INodeVersion, INodeVersionInfo} from './base-models.js';
|
||||||
|
|
||||||
export default abstract class BaseDistribution {
|
export default abstract class BaseDistribution {
|
||||||
protected httpClient: hc.HttpClient;
|
protected httpClient: hc.HttpClient;
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import BaseDistribution from './base-distribution';
|
import BaseDistribution from './base-distribution.js';
|
||||||
import {NodeInputs} from './base-models';
|
import {NodeInputs} from './base-models.js';
|
||||||
import NightlyNodejs from './nightly/nightly_builds';
|
import NightlyNodejs from './nightly/nightly_builds.js';
|
||||||
import OfficialBuilds from './official_builds/official_builds';
|
import OfficialBuilds from './official_builds/official_builds.js';
|
||||||
import RcBuild from './rc/rc_builds';
|
import RcBuild from './rc/rc_builds.js';
|
||||||
import CanaryBuild from './v8-canary/canary_builds';
|
import CanaryBuild from './v8-canary/canary_builds.js';
|
||||||
|
|
||||||
enum Distributions {
|
enum Distributions {
|
||||||
DEFAULT = '',
|
DEFAULT = '',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
import BasePrereleaseNodejs from '../base-distribution-prerelease.js';
|
||||||
import {NodeInputs} from '../base-models';
|
import {NodeInputs} from '../base-models.js';
|
||||||
|
|
||||||
export default class NightlyNodejs extends BasePrereleaseNodejs {
|
export default class NightlyNodejs extends BasePrereleaseNodejs {
|
||||||
protected distribution = 'nightly';
|
protected distribution = 'nightly';
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import * as core from '@actions/core';
|
|||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import BaseDistribution from '../base-distribution';
|
import BaseDistribution from '../base-distribution.js';
|
||||||
import {NodeInputs, INodeVersion, INodeVersionInfo} from '../base-models';
|
import {NodeInputs, INodeVersion, INodeVersionInfo} from '../base-models.js';
|
||||||
|
|
||||||
interface INodeRelease extends tc.IToolRelease {
|
interface INodeRelease extends tc.IToolRelease {
|
||||||
lts?: string;
|
lts?: string;
|
||||||
@@ -221,8 +221,8 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
alias === '*'
|
alias === '*'
|
||||||
? numbered[numbered.length - 1]
|
? numbered[numbered.length - 1]
|
||||||
: n < 0
|
: n < 0
|
||||||
? numbered[numbered.length - 1 + n]
|
? numbered[numbered.length - 1 + n]
|
||||||
: aliases[alias];
|
: aliases[alias];
|
||||||
|
|
||||||
if (!release) {
|
if (!release) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import BaseDistribution from '../base-distribution';
|
import BaseDistribution from '../base-distribution.js';
|
||||||
import {NodeInputs} from '../base-models';
|
import {NodeInputs} from '../base-models.js';
|
||||||
|
|
||||||
export default class RcBuild extends BaseDistribution {
|
export default class RcBuild extends BaseDistribution {
|
||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
import BasePrereleaseNodejs from '../base-distribution-prerelease.js';
|
||||||
import {NodeInputs} from '../base-models';
|
import {NodeInputs} from '../base-models.js';
|
||||||
|
|
||||||
export default class CanaryBuild extends BasePrereleaseNodejs {
|
export default class CanaryBuild extends BasePrereleaseNodejs {
|
||||||
protected distribution = 'v8-canary';
|
protected distribution = 'v8-canary';
|
||||||
|
|||||||
68
src/main.ts
68
src/main.ts
@@ -3,13 +3,17 @@ import * as core from '@actions/core';
|
|||||||
import os from 'os';
|
import os from 'os';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import * as auth from './authutil';
|
import * as auth from './authutil.js';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import {restoreCache} from './cache-restore';
|
import {restoreCache} from './cache-restore.js';
|
||||||
import {isCacheFeatureAvailable} from './cache-utils';
|
import {isCacheFeatureAvailable} from './cache-utils.js';
|
||||||
import {getNodejsDistribution} from './distributions/installer-factory';
|
import {getNodejsDistribution} from './distributions/installer-factory.js';
|
||||||
import {getNodeVersionFromFile, printEnvDetailsAndSetOutput} from './util';
|
import {getNodeVersionFromFile, printEnvDetailsAndSetOutput} from './util.js';
|
||||||
import {State} from './constants';
|
import {State} from './constants.js';
|
||||||
|
import {fileURLToPath} from 'url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
@@ -67,14 +71,25 @@ export async function run() {
|
|||||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resolvedPackageManager = getNameFromPackageManagerField();
|
|
||||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||||
if (cache && isCacheFeatureAvailable()) {
|
|
||||||
core.saveState(State.CachePackageManager, cache);
|
if (isCacheFeatureAvailable()) {
|
||||||
await restoreCache(cache, cacheDependencyPath);
|
// if the cache input is provided, use it for caching.
|
||||||
} else if (resolvedPackageManager && packagemanagercache) {
|
if (cache) {
|
||||||
core.saveState(State.CachePackageManager, resolvedPackageManager);
|
core.saveState(State.CachePackageManager, cache);
|
||||||
await restoreCache(resolvedPackageManager, cacheDependencyPath);
|
await restoreCache(cache, cacheDependencyPath);
|
||||||
|
// package manager npm is detected from package.json, enable auto-caching for npm.
|
||||||
|
} else if (packagemanagercache) {
|
||||||
|
const resolvedPackageManager = getNameFromPackageManagerField();
|
||||||
|
if (resolvedPackageManager) {
|
||||||
|
core.info(
|
||||||
|
"Detected npm as the package manager from package.json's packageManager field. " +
|
||||||
|
'Auto caching has been enabled for npm. If you want to disable it, set package-manager-cache input to false'
|
||||||
|
);
|
||||||
|
core.saveState(State.CachePackageManager, resolvedPackageManager);
|
||||||
|
await restoreCache(resolvedPackageManager, cacheDependencyPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const matchersPath = path.join(__dirname, '../..', '.github');
|
const matchersPath = path.join(__dirname, '../..', '.github');
|
||||||
@@ -127,8 +142,7 @@ function resolveVersionInput(): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getNameFromPackageManagerField(): string | undefined {
|
export function getNameFromPackageManagerField(): string | undefined {
|
||||||
// Check packageManager field in package.json
|
const npmRegex = /^(\^)?npm(@.*)?$/; // matches "npm", "npm@...", "^npm@..."
|
||||||
const SUPPORTED_PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm'];
|
|
||||||
try {
|
try {
|
||||||
const packageJson = JSON.parse(
|
const packageJson = JSON.parse(
|
||||||
fs.readFileSync(
|
fs.readFileSync(
|
||||||
@@ -136,16 +150,24 @@ export function getNameFromPackageManagerField(): string | undefined {
|
|||||||
'utf-8'
|
'utf-8'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const pm = packageJson.packageManager;
|
|
||||||
if (typeof pm === 'string') {
|
// Check devEngines.packageManager first (object or array)
|
||||||
const regex = new RegExp(
|
const devPM = packageJson?.devEngines?.packageManager;
|
||||||
`^(?:\\^)?(${SUPPORTED_PACKAGE_MANAGERS.join('|')})@`
|
const devPMArray = devPM ? (Array.isArray(devPM) ? devPM : [devPM]) : [];
|
||||||
);
|
for (const obj of devPMArray) {
|
||||||
const match = pm.match(regex);
|
if (typeof obj?.name === 'string' && npmRegex.test(obj.name)) {
|
||||||
return match ? match[1] : undefined;
|
return 'npm';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check top-level packageManager
|
||||||
|
const topLevelPM = packageJson?.packageManager;
|
||||||
|
if (typeof topLevelPM === 'string' && npmRegex.test(topLevelPM)) {
|
||||||
|
return 'npm';
|
||||||
|
}
|
||||||
|
|
||||||
return undefined;
|
return undefined;
|
||||||
} catch (err) {
|
} catch {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
import {run} from './main';
|
import {run} from './main.js';
|
||||||
|
|
||||||
run();
|
run();
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"target": "es2022", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
"module": "es2022", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
|
"moduleResolution": "node", /* Specify module resolution strategy: 'node' or 'classic'. */
|
||||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
"resolveJsonModule": true, /* Allows importing modules with a '.json' extension, which is a common practice in node projects. */
|
"resolveJsonModule": true, /* Allows importing modules with a '.json' extension, which is a common practice in node projects. */
|
||||||
},
|
},
|
||||||
"exclude": ["__tests__", "lib", "node_modules"]
|
"exclude": ["lib", "node_modules"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user