mirror of
https://github.com/Borales/actions-yarn.git
synced 2026-06-24 17:19:26 +08:00
Compare commits
419 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3766bb1335 | |||
| faecda506a | |||
| d331fa9c2e | |||
| 1bbc10b5a6 | |||
| fc414c44ad | |||
| 63d3868d34 | |||
| 8b973a7158 | |||
| c6b32a6ff6 | |||
| 4409de64aa | |||
| ddce652109 | |||
| 707fb6e3f4 | |||
| 6487438ce1 | |||
| 427ce64b02 | |||
| 8e6586017a | |||
| 295cca5788 | |||
| c3b7647095 | |||
| b9811de9ce | |||
| c9bf90fa3a | |||
| efeb26cdd5 | |||
| f023bfc112 | |||
| bab69b2852 | |||
| b7c47ad0bb | |||
| 1395419aab | |||
| 3040e609fa | |||
| 0645e4abeb | |||
| d7c049893c | |||
| 8adfb2628f | |||
| b739ad3081 | |||
| 99c6504cc1 | |||
| ba04318713 | |||
| 0d8fe0c22b | |||
| 9853bfc3e5 | |||
| 3274fb193d | |||
| 8af0ad1a69 | |||
| 31efceb9e9 | |||
| ab05b3425e | |||
| 68b824faef | |||
| 840fc81780 | |||
| d385f975f0 | |||
| 442116e4ab | |||
| 2a9440a031 | |||
| 9bcc92cac7 | |||
| 73f88a1987 | |||
| 9fb45632df | |||
| dce706fbb2 | |||
| 83dc1aa129 | |||
| ca27fe74ed | |||
| 00cf072083 | |||
| 77f0002bcd | |||
| b917c519d5 | |||
| 49e8accabb | |||
| 90b15ebd79 | |||
| 29036f1f2e | |||
| 22a3c4ba4e | |||
| 5cae97c055 | |||
| 79156a5745 | |||
| 200e96892b | |||
| 3b4781c3a4 | |||
| e4680437db | |||
| a92cd1003d | |||
| f91b632782 | |||
| 8a3711523f | |||
| a004338e20 | |||
| 2c86fe3c85 | |||
| c81c91d2a0 | |||
| 95230c303c | |||
| 7a57ed7021 | |||
| 378e2bc53e | |||
| a9ffbc6c81 | |||
| 1d6a3c6ece | |||
| 1191d9b324 | |||
| 4a58126566 | |||
| 43b9723cd4 | |||
| 6dffffcc20 | |||
| 5aa849e48d | |||
| 52e9efe874 | |||
| ad4db8e394 | |||
| 672f75d791 | |||
| da945ed34f | |||
| 7b93e9f839 | |||
| 1b314fa462 | |||
| 6a98a3dd7b | |||
| f232aa98a3 | |||
| 0b3f8008e9 | |||
| 19b100c30a | |||
| ac3426f687 | |||
| 7845ba0e11 | |||
| 94196dc437 | |||
| 29b9b89ca7 | |||
| 63b2a62298 | |||
| 718efb93f7 | |||
| c18a189926 | |||
| 914dc914b9 | |||
| 7d4d72a9c5 | |||
| 38f1d9942c | |||
| e8f2af2c5d | |||
| 3df62277ee | |||
| 99ea9e0457 | |||
| 74a137fccb | |||
| 104d970a24 | |||
| 4c0a125c37 | |||
| c90f8b4000 | |||
| c5ef563248 | |||
| 6d78a9ac7e | |||
| 33edd9163c | |||
| efc7ee464b | |||
| 76817d7494 | |||
| f40aa07ca3 | |||
| 1ecb5fd302 | |||
| d5d4a0dec3 | |||
| 4a0855118b | |||
| e294b69b25 | |||
| d0fa461de7 | |||
| ac2aea07a6 | |||
| 76f967ee69 | |||
| 9b6d91f137 | |||
| 2e7e1a7e23 | |||
| c7c402843e | |||
| dd02a67c54 | |||
| 66607859b9 | |||
| 9c6f029722 | |||
| dde603b31d | |||
| c1066106c0 | |||
| 4f939f2edb | |||
| 2caa2f5ff8 | |||
| fd9d464350 | |||
| a8a85c4e7a | |||
| e0eecc98e7 | |||
| 6966adba7b | |||
| 3b8e77f5ca | |||
| 0571642958 | |||
| 902237bab5 | |||
| a0a7a6bac9 | |||
| f71f06becf | |||
| 327617430b | |||
| 563efe1b57 | |||
| 38983e5b2e | |||
| a70a6ea80f | |||
| 3201e5a9ce | |||
| b6475c305d | |||
| d142258bc4 | |||
| aefbeddbca | |||
| ec47e2e9d3 | |||
| 8894aa8f91 | |||
| 5e6abf7421 | |||
| 692f9768a0 | |||
| 956da5f64a | |||
| e86d8a790b | |||
| a12ef61504 | |||
| cbce86ddcc | |||
| 4a29158a1f | |||
| 79d1d41ae7 | |||
| 4e12c4b757 | |||
| 2ff2af6030 | |||
| 320643cfca | |||
| c09c46ba03 | |||
| 84570cd71f | |||
| 2198a6042c | |||
| 556b3140ab | |||
| 8003e88ac3 | |||
| fd2eea86d9 | |||
| 529212a8dc | |||
| 3c30d8e29e | |||
| 073245c5fa | |||
| 0f5882cd72 | |||
| 4b27e7dec9 | |||
| b3c438497d | |||
| 278efa59ef | |||
| 977e1521ae | |||
| 8e005ed3e4 | |||
| 18b1b89898 | |||
| 0918d223be | |||
| d492966f87 | |||
| 31d1d5b09d | |||
| d57c177ed8 | |||
| b6640a847a | |||
| 694bae218f | |||
| b249b12356 | |||
| 56f787418b | |||
| de564463d9 | |||
| 962bfcb6c4 | |||
| e38028f485 | |||
| e14170720c | |||
| 2ccf4ed387 | |||
| c6f19323a5 | |||
| 621138a3e3 | |||
| cbc4a7fa1c | |||
| 61ff2d579f | |||
| dac4067e57 | |||
| 4d7c6e5ded | |||
| 1827c0f74b | |||
| 35c544572f | |||
| e764b39183 | |||
| 894b29525a | |||
| 38166f9e5e | |||
| 2a0dafeeac | |||
| e6830503b8 | |||
| 46a9f103bd | |||
| b9a1047145 | |||
| c1fb369259 | |||
| a292d8b3a7 | |||
| 2111d603b2 | |||
| 958f1b4c34 | |||
| 800f8fdcc1 | |||
| 6b77643ff6 | |||
| f27d79b1f0 | |||
| 3b43067d2d | |||
| cec72e20c1 | |||
| 07189d3b03 | |||
| 01ed26b2ba | |||
| 0fd55cce10 | |||
| d4aaddb6df | |||
| 87e46c2e24 | |||
| f4c028f9ee | |||
| fee138c834 | |||
| 2cbb746488 | |||
| 8d25cc014a | |||
| 3fe7e73952 | |||
| 9b638ee9e4 | |||
| 746dbc6086 | |||
| 022d0f6490 | |||
| 50f715fe2f | |||
| 4456aa6143 | |||
| e0aba9225b | |||
| 7910697d90 | |||
| 238ce18b97 | |||
| 6ccb9261b2 | |||
| e69cedaf3d | |||
| c7a2c75fbe | |||
| 9d92cc1445 | |||
| 68013b5f76 | |||
| 9ff3eb4477 | |||
| ca34f4778b | |||
| 3c1ccaa563 | |||
| 7858686081 | |||
| e3790a19cd | |||
| c53ed58506 | |||
| d75562382f | |||
| 8034f3ae97 | |||
| 29938bd298 | |||
| f10f4a732c | |||
| ef0318c1e9 | |||
| c71c83c4c8 | |||
| 5fd1324c61 | |||
| 71e1a82bab | |||
| ddd47ead40 | |||
| c6062c683f | |||
| 16afe60722 | |||
| 42fedb7e6c | |||
| 69574201a5 | |||
| 513afc3d3c | |||
| 9733cebcf7 | |||
| 7ac317d4c5 | |||
| ec9f35e3bf | |||
| 8993aaf190 | |||
| a7fcc53c02 | |||
| 603cae9de2 | |||
| c2c61380e0 | |||
| 0a27a8d39a | |||
| fb56911a15 | |||
| f90b2c0b1a | |||
| 04b5190a76 | |||
| cb2a38747c | |||
| 260113a0d2 | |||
| 1706898e71 | |||
| 53208599a5 | |||
| 3ff42f849e | |||
| 0916920fea | |||
| 6433a2c3e6 | |||
| d9aff06871 | |||
| 9624c7ed8f | |||
| 6691ee905d | |||
| 4b3415f39b | |||
| fea181acaa | |||
| 97646b6c46 | |||
| 3b5d37ac53 | |||
| 54e0c70543 | |||
| 16c94da5c1 | |||
| f0744b1b84 | |||
| c40a940add | |||
| 34d85a2dfe | |||
| c6630b5ce4 | |||
| 34871f1ee6 | |||
| 8ba275be47 | |||
| bb80d98b8b | |||
| 193d1c42ac | |||
| 99be449dac | |||
| 218c35ca29 | |||
| 3f72735fe6 | |||
| f3a0749aa6 | |||
| f73ab9df9d | |||
| 1bbb20eee1 | |||
| 6fc6c3666d | |||
| 9e5f069677 | |||
| d591e3c049 | |||
| 926efbb654 | |||
| 1d06d69e1f | |||
| 34f1ef1bd5 | |||
| d677a8d911 | |||
| c6164ef5a4 | |||
| b1e4ce424b | |||
| f4fbc70851 | |||
| 8b08264142 | |||
| be723317f6 | |||
| e915758dbd | |||
| b854bfb0d8 | |||
| f7160ee49a | |||
| bf8c7d6340 | |||
| 08411a890a | |||
| c6942a99f8 | |||
| b2026bd422 | |||
| 5de75ccdd1 | |||
| 88ecdb0d3c | |||
| a61398574a | |||
| 9f1628b7a6 | |||
| 45954e678c | |||
| 0a87ba687b | |||
| ea1e7c5230 | |||
| d66f84e169 | |||
| 8555b485df | |||
| 59e3e558a5 | |||
| c7bd3680cb | |||
| 8e8f6b1eb2 | |||
| 6820f555c0 | |||
| 3530b98ad8 | |||
| d629be3ea0 | |||
| e1bc704a84 | |||
| db27e2339b | |||
| 53f897ccaf | |||
| 39f840050a | |||
| 1f75977d29 | |||
| cf361697fd | |||
| 6c0bcbcaad | |||
| f81ea21c79 | |||
| 83f8cc541c | |||
| 1c99bd65df | |||
| 65a490330b | |||
| 7cb627d7ed | |||
| ed15d8809b | |||
| 0a24d1fad2 | |||
| 55ca073f4c | |||
| 5c373aaa5c | |||
| 3e8f161271 | |||
| 069531565d | |||
| 452d632cde | |||
| 6ef2c43c49 | |||
| ab8b76ed4f | |||
| 19a366b7f8 | |||
| c1a2d5b3cd | |||
| 50857cb06f | |||
| 3fe4d9e231 | |||
| 8ca086c476 | |||
| 180206fc8b | |||
| 6d6b09d898 | |||
| 778d3d8b05 | |||
| aa1d957fdd | |||
| c3a133b56a | |||
| 63f1fcf2aa | |||
| 5f7557f715 | |||
| 7e6f3ef235 | |||
| 7381196c4c | |||
| e643ac26f5 | |||
| 8aa65a7bdf | |||
| 6a23fcfb75 | |||
| d62689e1f9 | |||
| 16d9240525 | |||
| 9ef6c1f83b | |||
| bdabd7531d | |||
| 85bb3c6650 | |||
| 2b82425e69 | |||
| 1bea398627 | |||
| fdef96617e | |||
| 5ee6f31726 | |||
| 588a5ae9a0 | |||
| e13cc552c7 | |||
| 49647aab6a | |||
| 7bcb5309df | |||
| e7e06ab92c | |||
| 6446bdba7c | |||
| a91b00b2ef | |||
| 616797d406 | |||
| d84209f2e6 | |||
| d00d0491a4 | |||
| a5b6fc5ff9 | |||
| 5dc0f9d1ee | |||
| 0df7dfb76f | |||
| 736dded4c7 | |||
| 65d6ff917a | |||
| 9e2b8318aa | |||
| 18342e3784 | |||
| 0fef9c9cb4 | |||
| 36db23d1c1 | |||
| 7b41b68187 | |||
| bc5bc8c00d | |||
| 5b0fd1b356 | |||
| ea928198c6 | |||
| adffcf1a4c | |||
| c0bd87bb8f | |||
| 336129caf7 | |||
| 972a24df0e | |||
| d306662790 | |||
| b8595f4a11 | |||
| ac4557836a | |||
| 1e254dbd30 | |||
| 0f90e8521a | |||
| 1acdbcd2de | |||
| 0cc313ad9b | |||
| 97ba8bebfe | |||
| d8b5ea8c26 | |||
| ac4aa8b421 | |||
| d0b398ccef | |||
| 32394b360b | |||
| b257940aaa | |||
| 062383b267 | |||
| d236877258 | |||
| 21a4e475d0 | |||
| 16098ef84e | |||
| 9e77a0618b | |||
| 17af3bf048 |
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
|
"extends": ["config:base", "group:typescript-eslintMonorepo"],
|
||||||
|
"labels": ["dependencies"],
|
||||||
|
"rangeStrategy": "bump",
|
||||||
|
"reviewers": ["borales"],
|
||||||
|
"postUpdateOptions": ["yarnDedupeHighest"],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchSourceUrlPrefixes": ["https://github.com/actions/toolkit"],
|
||||||
|
"groupName": "GitHub Actions Toolkit"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -16,20 +16,20 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- name: Set Node.js 20
|
||||||
uses: actions/setup-node@v3.5.1
|
uses: actions/setup-node@v4.0.1
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 20
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: yarn
|
||||||
|
|
||||||
- name: Rebuild the dist/ directory
|
- name: Rebuild the dist/ directory
|
||||||
run: |
|
run: |
|
||||||
npm run build
|
yarn build
|
||||||
npm run package
|
yarn package
|
||||||
- name: Compare the expected and actual dist/ directories
|
- name: Compare the expected and actual dist/ directories
|
||||||
run: |
|
run: |
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
||||||
@@ -40,7 +40,7 @@ jobs:
|
|||||||
id: diff
|
id: diff
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If index.js was different than expected, upload the expected version as an artifact
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
|||||||
@@ -1,5 +1,17 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 5.0.0 (3 Feb 2024)
|
||||||
|
|
||||||
|
- Switching to `node20`
|
||||||
|
|
||||||
|
## 4.2.0 (5 Dec 2022)
|
||||||
|
|
||||||
|
- Added proper support for multiple arguments
|
||||||
|
|
||||||
|
## 4.1.0 (26 Nov 2022)
|
||||||
|
|
||||||
|
- Added `dir` option
|
||||||
|
|
||||||
## 4.0.0 (26 Nov 2022)
|
## 4.0.0 (26 Nov 2022)
|
||||||
|
|
||||||
- Migrated to Actions toolkit
|
- Migrated to Actions toolkit
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2023 Oleksandr Bordun
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -6,11 +6,14 @@ This Action for [yarn](https://yarnpkg.com) enables arbitrary actions with the `
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
> It is required to run `actions/setup-node@v3` before `borales/actions-yarn` in order to setup the desired node version.
|
||||||
|
|
||||||
An example workflow how to install packages via Yarn (using repository syntax):
|
An example workflow how to install packages via Yarn (using repository syntax):
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
name: CI
|
name: CI
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Test
|
name: Test
|
||||||
@@ -37,8 +40,16 @@ jobs:
|
|||||||
uses: borales/actions-yarn@v4
|
uses: borales/actions-yarn@v4
|
||||||
with:
|
with:
|
||||||
cmd: test # will run `yarn test` command
|
cmd: test # will run `yarn test` command
|
||||||
|
|
||||||
|
- name: Run test in sub-folder
|
||||||
|
uses: borales/actions-yarn@v4
|
||||||
|
with:
|
||||||
|
cmd: test
|
||||||
|
dir: 'frontend' # will run `yarn test` in `frontend` sub folder
|
||||||
```
|
```
|
||||||
|
|
||||||
> `cmd` value will be used as a command for Yarn
|
> `cmd` value will be used as a command for Yarn
|
||||||
|
>
|
||||||
|
> `dir` value will be used for Yarn `cwd`
|
||||||
|
|
||||||
More information about [private registry setup](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#use-private-packages).
|
More information about [private registry setup](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#use-private-packages).
|
||||||
|
|||||||
+5
-8
@@ -8,13 +8,10 @@ inputs:
|
|||||||
cmd:
|
cmd:
|
||||||
description: 'Yarn command'
|
description: 'Yarn command'
|
||||||
required: true
|
required: true
|
||||||
# auth-token:
|
dir:
|
||||||
# description: 'NPM_AUTH_TOKEN'
|
description: 'Yarn sub-folder (if needed)'
|
||||||
# registry-url:
|
required: false
|
||||||
# description: 'NPM_REGISTRY_URL'
|
default: ''
|
||||||
runs:
|
runs:
|
||||||
using: 'node16'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
# env:
|
|
||||||
# NPM_AUTH_TOKEN: ${{ inputs.auth-token }}
|
|
||||||
# NPM_REGISTRY_URL: ${{ inputs.registry-url }}
|
|
||||||
|
|||||||
Vendored
+24
-58
@@ -19,10 +19,12 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
const core_1 = __nccwpck_require__(186);
|
const core_1 = __nccwpck_require__(186);
|
||||||
const yarn_1 = __nccwpck_require__(820);
|
const yarn_1 = __nccwpck_require__(820);
|
||||||
const run_1 = __nccwpck_require__(884);
|
const run_1 = __nccwpck_require__(884);
|
||||||
|
const path_1 = __nccwpck_require__(17);
|
||||||
const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
const main = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
yield (0, yarn_1.ensureYarnIsInstalled)();
|
yield (0, yarn_1.ensureYarnIsInstalled)();
|
||||||
const cmd = (0, core_1.getInput)('cmd', { required: true });
|
const cmd = (0, core_1.getInput)('cmd', { required: true });
|
||||||
const cwd = (0, core_1.getState)('repositoryPath');
|
const dir = (0, core_1.getInput)('dir');
|
||||||
|
const cwd = (0, path_1.resolve)((0, core_1.getState)('repositoryPath'), dir || '');
|
||||||
try {
|
try {
|
||||||
(0, core_1.debug)(`Running "${cmd}" command`);
|
(0, core_1.debug)(`Running "${cmd}" command`);
|
||||||
yield (0, run_1.run)(cmd, { cwd });
|
yield (0, run_1.run)(cmd, { cwd });
|
||||||
@@ -55,7 +57,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.run = void 0;
|
exports.run = void 0;
|
||||||
const exec_1 = __nccwpck_require__(514);
|
const exec_1 = __nccwpck_require__(514);
|
||||||
const run = (cmd, { cwd }) => __awaiter(void 0, void 0, void 0, function* () {
|
const run = (cmd, { cwd }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
yield (0, exec_1.exec)('yarn', [cmd], { cwd });
|
yield (0, exec_1.exec)('yarn', cmd.split(' '), { cwd });
|
||||||
});
|
});
|
||||||
exports.run = run;
|
exports.run = run;
|
||||||
|
|
||||||
@@ -658,7 +660,7 @@ class OidcClient {
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
throw new Error(`Failed to get ID Token. \n
|
throw new Error(`Failed to get ID Token. \n
|
||||||
Error Code : ${error.statusCode}\n
|
Error Code : ${error.statusCode}\n
|
||||||
Error Message: ${error.result.message}`);
|
Error Message: ${error.message}`);
|
||||||
});
|
});
|
||||||
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
|
||||||
if (!id_token) {
|
if (!id_token) {
|
||||||
@@ -2632,11 +2634,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
};
|
};
|
||||||
var _a;
|
var _a;
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
||||||
const fs = __importStar(__nccwpck_require__(147));
|
const fs = __importStar(__nccwpck_require__(147));
|
||||||
const path = __importStar(__nccwpck_require__(17));
|
const path = __importStar(__nccwpck_require__(17));
|
||||||
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
_a = fs.promises
|
||||||
|
// export const {open} = 'fs'
|
||||||
|
, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
||||||
|
// export const {open} = 'fs'
|
||||||
exports.IS_WINDOWS = process.platform === 'win32';
|
exports.IS_WINDOWS = process.platform === 'win32';
|
||||||
|
// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
|
||||||
|
exports.UV_FS_O_EXLOCK = 0x10000000;
|
||||||
|
exports.READONLY = fs.constants.O_RDONLY;
|
||||||
function exists(fsPath) {
|
function exists(fsPath) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
@@ -2817,12 +2825,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
||||||
const assert_1 = __nccwpck_require__(491);
|
const assert_1 = __nccwpck_require__(491);
|
||||||
const childProcess = __importStar(__nccwpck_require__(81));
|
|
||||||
const path = __importStar(__nccwpck_require__(17));
|
const path = __importStar(__nccwpck_require__(17));
|
||||||
const util_1 = __nccwpck_require__(837);
|
|
||||||
const ioUtil = __importStar(__nccwpck_require__(962));
|
const ioUtil = __importStar(__nccwpck_require__(962));
|
||||||
const exec = util_1.promisify(childProcess.exec);
|
|
||||||
const execFile = util_1.promisify(childProcess.execFile);
|
|
||||||
/**
|
/**
|
||||||
* Copies a file or folder.
|
* Copies a file or folder.
|
||||||
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
||||||
@@ -2903,61 +2907,23 @@ exports.mv = mv;
|
|||||||
function rmRF(inputPath) {
|
function rmRF(inputPath) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if (ioUtil.IS_WINDOWS) {
|
if (ioUtil.IS_WINDOWS) {
|
||||||
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
|
||||||
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
|
||||||
// Check for invalid characters
|
// Check for invalid characters
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
||||||
if (/[*"<>|]/.test(inputPath)) {
|
if (/[*"<>|]/.test(inputPath)) {
|
||||||
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
const cmdPath = ioUtil.getCmdPath();
|
|
||||||
if (yield ioUtil.isDirectory(inputPath, true)) {
|
|
||||||
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
|
||||||
env: { inputPath }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
|
||||||
env: { inputPath }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
|
||||||
try {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
|
||||||
// other errors are valid
|
|
||||||
if (err.code !== 'ENOENT')
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
try {
|
||||||
let isDir = false;
|
// note if path does not exist, error is silent
|
||||||
try {
|
yield ioUtil.rm(inputPath, {
|
||||||
isDir = yield ioUtil.isDirectory(inputPath);
|
force: true,
|
||||||
}
|
maxRetries: 3,
|
||||||
catch (err) {
|
recursive: true,
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
retryDelay: 300
|
||||||
// other errors are valid
|
});
|
||||||
if (err.code !== 'ENOENT')
|
}
|
||||||
throw err;
|
catch (err) {
|
||||||
return;
|
throw new Error(`File was unable to be removed ${err}`);
|
||||||
}
|
|
||||||
if (isDir) {
|
|
||||||
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield ioUtil.unlink(inputPath);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Generated
-5764
File diff suppressed because it is too large
Load Diff
+13
-13
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@borales/actions-yarn",
|
"name": "@borales/actions-yarn",
|
||||||
"version": "4.0.0",
|
"version": "4.2.0",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
@@ -9,22 +9,22 @@
|
|||||||
"lint": "eslint src/**/*.ts",
|
"lint": "eslint src/**/*.ts",
|
||||||
"package": "ncc build --source-map --license licenses.txt",
|
"package": "ncc build --source-map --license licenses.txt",
|
||||||
"test": "jest",
|
"test": "jest",
|
||||||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
|
"all": "yarn build && yarn format && yarn lint && yarn package && yarn test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.2"
|
"@actions/io": "^1.1.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^18.11.9",
|
"@types/node": "^20.11.16",
|
||||||
"@typescript-eslint/parser": "^5.44.0",
|
"@typescript-eslint/parser": "^6.20.0",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"eslint-plugin-github": "^4.4.1",
|
"eslint-plugin-github": "^4.10.1",
|
||||||
"eslint-plugin-jest": "^27.1.6",
|
"eslint-plugin-jest": "^27.6.3",
|
||||||
"eslint": "^8.28.0",
|
"eslint": "^8.56.0",
|
||||||
"jest": "^29.3.1",
|
"jest": "^29.7.0",
|
||||||
"prettier": "^2.8.0",
|
"prettier": "^3.2.4",
|
||||||
"typescript": "^4.9.3"
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -1,12 +1,14 @@
|
|||||||
import {debug, getInput, setFailed, getState} from '@actions/core'
|
import {debug, getInput, setFailed, getState} from '@actions/core'
|
||||||
import {ensureYarnIsInstalled} from './yarn'
|
import {ensureYarnIsInstalled} from './yarn'
|
||||||
import {run} from './run'
|
import {run} from './run'
|
||||||
|
import {resolve} from 'path'
|
||||||
|
|
||||||
const main = async () => {
|
const main = async (): Promise<void> => {
|
||||||
await ensureYarnIsInstalled()
|
await ensureYarnIsInstalled()
|
||||||
|
|
||||||
const cmd: string = getInput('cmd', {required: true})
|
const cmd: string = getInput('cmd', {required: true})
|
||||||
const cwd: string = getState('repositoryPath')
|
const dir: string = getInput('dir')
|
||||||
|
const cwd: string = resolve(getState('repositoryPath'), dir || '')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
debug(`Running "${cmd}" command`)
|
debug(`Running "${cmd}" command`)
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
import {exec} from '@actions/exec'
|
import {exec} from '@actions/exec'
|
||||||
|
|
||||||
export const run = async (cmd: string, {cwd}: {cwd: string}) => {
|
export const run = async (cmd: string, {cwd}: {cwd: string}): Promise<void> => {
|
||||||
await exec('yarn', [cmd], {cwd})
|
await exec('yarn', cmd.split(' '), {cwd})
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ import {debug, setOutput} from '@actions/core'
|
|||||||
import {exec, getExecOutput} from '@actions/exec'
|
import {exec, getExecOutput} from '@actions/exec'
|
||||||
import {which} from '@actions/io'
|
import {which} from '@actions/io'
|
||||||
|
|
||||||
export const ensureYarnIsInstalled = async () => {
|
export const ensureYarnIsInstalled = async (): Promise<void> => {
|
||||||
try {
|
try {
|
||||||
await which('yarn', true)
|
await which('yarn', true)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user