mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-21 17:43:23 +01:00
Merge pull request #154 from cloudflare/jacobmgevans/silence-mode
Quiet feature
This commit is contained in:
commit
0aa12f0c2b
9 changed files with 134 additions and 73 deletions
12
.changeset/gold-moose-check.md
Normal file
12
.changeset/gold-moose-check.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
"wrangler-action": minor
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: Quiet mode
|
||||||
|
Some of the stderr, stdout, info & groupings can be a little noisy for some users and use cases.
|
||||||
|
This feature allows for a option to be passed 'quiet: true' this would significantly reduce the noise.
|
||||||
|
|
||||||
|
There will still be output that lets the user know Wrangler Installed and Wrangler Action completed successfully.
|
||||||
|
Any failure status will still be output to the user as well, to prevent silent failures.
|
||||||
|
|
||||||
|
resolves #142
|
9
.github/workflows/deploy.yml
vendored
9
.github/workflows/deploy.yml
vendored
|
@ -34,6 +34,15 @@ jobs:
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
command: deploy --dry-run
|
command: deploy --dry-run
|
||||||
|
|
||||||
|
- name: Only build app w/ quiet enabled
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
quiet: true
|
||||||
|
workingDirectory: "./test/base"
|
||||||
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
command: deploy --dry-run
|
||||||
|
|
||||||
# START Setup and teardown of Worker Environment Tests
|
# START Setup and teardown of Worker Environment Tests
|
||||||
- name: Environment support
|
- name: Environment support
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|
8
.github/workflows/workerHealthCheck.cjs
vendored
8
.github/workflows/workerHealthCheck.cjs
vendored
|
@ -8,9 +8,11 @@ function workerHealthCheck() {
|
||||||
|
|
||||||
const response = buffer.toString();
|
const response = buffer.toString();
|
||||||
|
|
||||||
response.includes("OK")
|
if (response.includes("OK")) {
|
||||||
? console.log(`Status: Worker is up! Secrets: ${response}`)
|
console.log(`Status: Worker is up! Response: ${response}`);
|
||||||
: console.log(`Worker is down!`);
|
} else {
|
||||||
|
throw new Error(`Worker is down! Response: ${response}`);
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
1
action-env-setup.ts
Normal file
1
action-env-setup.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
process.env.INPUT_QUIET ??= "false";
|
|
@ -13,7 +13,10 @@ inputs:
|
||||||
accountId:
|
accountId:
|
||||||
description: "Your Cloudflare Account ID"
|
description: "Your Cloudflare Account ID"
|
||||||
required: false
|
required: false
|
||||||
|
quiet:
|
||||||
|
description: "Supresses output from Wrangler commands, defaults to `false`"
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
environment:
|
environment:
|
||||||
description: "The environment you'd like to deploy your Workers project to - must be defined in wrangler.toml"
|
description: "The environment you'd like to deploy your Workers project to - must be defined in wrangler.toml"
|
||||||
workingDirectory:
|
workingDirectory:
|
||||||
|
|
114
package-lock.json
generated
114
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "wrangler-action",
|
"name": "wrangler-action",
|
||||||
"version": "3.0.1",
|
"version": "3.0.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "wrangler-action",
|
"name": "wrangler-action",
|
||||||
"version": "3.0.1",
|
"version": "3.0.2",
|
||||||
"license": "MIT OR Apache-2.0",
|
"license": "MIT OR Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0"
|
"@actions/core": "^1.10.0"
|
||||||
|
@ -14,12 +14,12 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/changelog-github": "^0.4.8",
|
"@changesets/changelog-github": "^0.4.8",
|
||||||
"@changesets/cli": "^2.26.2",
|
"@changesets/cli": "^2.26.2",
|
||||||
"@cloudflare/workers-types": "^4.20230710.1",
|
"@cloudflare/workers-types": "^4.20230814.0",
|
||||||
"@types/node": "^20.4.2",
|
"@types/node": "^20.5.0",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"prettier": "^3.0.0",
|
"prettier": "^3.0.1",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"vitest": "^0.33.0"
|
"vitest": "^0.34.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/core": {
|
"node_modules/@actions/core": {
|
||||||
|
@ -366,9 +366,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@cloudflare/workers-types": {
|
"node_modules/@cloudflare/workers-types": {
|
||||||
"version": "4.20230801.0",
|
"version": "4.20230814.0",
|
||||||
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20230801.0.tgz",
|
"resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20230814.0.tgz",
|
||||||
"integrity": "sha512-RzRUR+J/T3h58qbTZHYntYsnZXu3JnrlZIhqP2hhdyfoZAZ/+ko4wX0foAqlYHi+kXWaWtySHBuMcx6ec6TXlQ==",
|
"integrity": "sha512-+jHiGjZg2UpULZSSHmHLqUG45TLg1s+uppSMlGvMn0u/xyFsRX9HX6b8Ydg/oHSp3jfSuPtX05GSvtgRAmrWTg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/android-arm": {
|
"node_modules/@esbuild/android-arm": {
|
||||||
|
@ -879,9 +879,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.4.6",
|
"version": "20.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.0.tgz",
|
||||||
"integrity": "sha512-q0RkvNgMweWWIvSMDiXhflGUKMdIxBo2M2tYM/0kEGDueQByFzK4KZAgu5YHGFNxziTlppNpTIBcqHQAxlfHdA==",
|
"integrity": "sha512-Mgq7eCtoTjT89FqNoTzzXg2XvCi5VMhRV6+I2aYanc6kQCBImeNaAYRs/DyoVqk1YEUJK5gN9VO7HRIdz4Wo3Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/normalize-package-data": {
|
"node_modules/@types/normalize-package-data": {
|
||||||
|
@ -906,13 +906,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vitest/expect": {
|
"node_modules/@vitest/expect": {
|
||||||
"version": "0.33.0",
|
"version": "0.34.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.33.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-0.34.1.tgz",
|
||||||
"integrity": "sha512-sVNf+Gla3mhTCxNJx+wJLDPp/WcstOe0Ksqz4Vec51MmgMth/ia0MGFEkIZmVGeTL5HtjYR4Wl/ZxBxBXZJTzQ==",
|
"integrity": "sha512-q2CD8+XIsQ+tHwypnoCk8Mnv5e6afLFvinVGCq3/BOT4kQdVQmY6rRfyKkwcg635lbliLPqbunXZr+L1ssUWiQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitest/spy": "0.33.0",
|
"@vitest/spy": "0.34.1",
|
||||||
"@vitest/utils": "0.33.0",
|
"@vitest/utils": "0.34.1",
|
||||||
"chai": "^4.3.7"
|
"chai": "^4.3.7"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
|
@ -920,12 +920,12 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vitest/runner": {
|
"node_modules/@vitest/runner": {
|
||||||
"version": "0.33.0",
|
"version": "0.34.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.33.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-0.34.1.tgz",
|
||||||
"integrity": "sha512-UPfACnmCB6HKRHTlcgCoBh6ppl6fDn+J/xR8dTufWiKt/74Y9bHci5CKB8tESSV82zKYtkBJo9whU3mNvfaisg==",
|
"integrity": "sha512-YfQMpYzDsYB7yqgmlxZ06NI4LurHWfrH7Wy3Pvf/z/vwUSgq1zLAb1lWcItCzQG+NVox+VvzlKQrYEXb47645g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vitest/utils": "0.33.0",
|
"@vitest/utils": "0.34.1",
|
||||||
"p-limit": "^4.0.0",
|
"p-limit": "^4.0.0",
|
||||||
"pathe": "^1.1.1"
|
"pathe": "^1.1.1"
|
||||||
},
|
},
|
||||||
|
@ -949,9 +949,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vitest/snapshot": {
|
"node_modules/@vitest/snapshot": {
|
||||||
"version": "0.33.0",
|
"version": "0.34.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.33.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-0.34.1.tgz",
|
||||||
"integrity": "sha512-tJjrl//qAHbyHajpFvr8Wsk8DIOODEebTu7pgBrP07iOepR5jYkLFiqLq2Ltxv+r0uptUb4izv1J8XBOwKkVYA==",
|
"integrity": "sha512-0O9LfLU0114OqdF8lENlrLsnn024Tb1CsS9UwG0YMWY2oGTQfPtkW+B/7ieyv0X9R2Oijhi3caB1xgGgEgclSQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"magic-string": "^0.30.1",
|
"magic-string": "^0.30.1",
|
||||||
|
@ -963,9 +963,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vitest/spy": {
|
"node_modules/@vitest/spy": {
|
||||||
"version": "0.33.0",
|
"version": "0.34.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.33.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-0.34.1.tgz",
|
||||||
"integrity": "sha512-Kv+yZ4hnH1WdiAkPUQTpRxW8kGtH8VRTnus7ZTGovFYM1ZezJpvGtb9nPIjPnptHbsyIAxYZsEpVPYgtpjGnrg==",
|
"integrity": "sha512-UT4WcI3EAPUNO8n6y9QoEqynGGEPmmRxC+cLzneFFXpmacivjHZsNbiKD88KUScv5DCHVDgdBsLD7O7s1enFcQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tinyspy": "^2.1.1"
|
"tinyspy": "^2.1.1"
|
||||||
|
@ -975,9 +975,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vitest/utils": {
|
"node_modules/@vitest/utils": {
|
||||||
"version": "0.33.0",
|
"version": "0.34.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.33.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-0.34.1.tgz",
|
||||||
"integrity": "sha512-pF1w22ic965sv+EN6uoePkAOTkAPWM03Ri/jXNyMIKBb/XHLDPfhLvf/Fa9g0YECevAIz56oVYXhodLvLQ/awA==",
|
"integrity": "sha512-/ql9dsFi4iuEbiNcjNHQWXBum7aL8pyhxvfnD9gNtbjR9fUKAjxhj4AA3yfLXg6gJpMGGecvtF8Au2G9y3q47Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"diff-sequences": "^29.4.3",
|
"diff-sequences": "^29.4.3",
|
||||||
|
@ -3054,9 +3054,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/prettier": {
|
"node_modules/prettier": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.1.tgz",
|
||||||
"integrity": "sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==",
|
"integrity": "sha512-fcOWSnnpCrovBsmFZIGIy9UqK2FaI7Hqax+DIO0A9UxeVoY4iweyaFjS5TavZN97Hfehph0nhsZnjlVKzEQSrQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"prettier": "bin/prettier.cjs"
|
"prettier": "bin/prettier.cjs"
|
||||||
|
@ -3288,9 +3288,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rollup": {
|
"node_modules/rollup": {
|
||||||
"version": "3.27.0",
|
"version": "3.28.0",
|
||||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.27.0.tgz",
|
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.28.0.tgz",
|
||||||
"integrity": "sha512-aOltLCrYZ0FhJDm7fCqwTjIUEVjWjcydKBV/Zeid6Mn8BWgDCUBBWT5beM5ieForYNo/1ZHuGJdka26kvQ3Gzg==",
|
"integrity": "sha512-d7zhvo1OUY2SXSM6pfNjgD5+d0Nz87CUp4mt8l/GgVP3oBsPwzNvSzyu1me6BSG9JIgWNTVcafIXBIyM8yQ3yw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"rollup": "dist/bin/rollup"
|
"rollup": "dist/bin/rollup"
|
||||||
|
@ -3772,9 +3772,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/tinypool": {
|
"node_modules/tinypool": {
|
||||||
"version": "0.6.0",
|
"version": "0.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/tinypool/-/tinypool-0.7.0.tgz",
|
||||||
"integrity": "sha512-FdswUUo5SxRizcBc6b1GSuLpLjisa8N8qMyYoP3rl+bym+QauhtJP5bvZY1ytt8krKGmMLYIRl36HBZfeAoqhQ==",
|
"integrity": "sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
|
@ -4075,14 +4075,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite": {
|
"node_modules/vite": {
|
||||||
"version": "4.4.8",
|
"version": "4.4.9",
|
||||||
"resolved": "https://registry.npmjs.org/vite/-/vite-4.4.8.tgz",
|
"resolved": "https://registry.npmjs.org/vite/-/vite-4.4.9.tgz",
|
||||||
"integrity": "sha512-LONawOUUjxQridNWGQlNizfKH89qPigK36XhMI7COMGztz8KNY0JHim7/xDd71CZwGT4HtSRgI7Hy+RlhG0Gvg==",
|
"integrity": "sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"esbuild": "^0.18.10",
|
"esbuild": "^0.18.10",
|
||||||
"postcss": "^8.4.26",
|
"postcss": "^8.4.27",
|
||||||
"rollup": "^3.25.2"
|
"rollup": "^3.27.1"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"vite": "bin/vite.js"
|
"vite": "bin/vite.js"
|
||||||
|
@ -4130,9 +4130,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vite-node": {
|
"node_modules/vite-node": {
|
||||||
"version": "0.33.0",
|
"version": "0.34.1",
|
||||||
"resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.33.0.tgz",
|
"resolved": "https://registry.npmjs.org/vite-node/-/vite-node-0.34.1.tgz",
|
||||||
"integrity": "sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==",
|
"integrity": "sha512-odAZAL9xFMuAg8aWd7nSPT+hU8u2r9gU3LRm9QKjxBEF2rRdWpMuqkrkjvyVQEdNFiBctqr2Gg4uJYizm5Le6w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cac": "^6.7.14",
|
"cac": "^6.7.14",
|
||||||
|
@ -4153,19 +4153,19 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vitest": {
|
"node_modules/vitest": {
|
||||||
"version": "0.33.0",
|
"version": "0.34.1",
|
||||||
"resolved": "https://registry.npmjs.org/vitest/-/vitest-0.33.0.tgz",
|
"resolved": "https://registry.npmjs.org/vitest/-/vitest-0.34.1.tgz",
|
||||||
"integrity": "sha512-1CxaugJ50xskkQ0e969R/hW47za4YXDUfWJDxip1hwbnhUjYolpfUn2AMOulqG/Dtd9WYAtkHmM/m3yKVrEejQ==",
|
"integrity": "sha512-G1PzuBEq9A75XSU88yO5G4vPT20UovbC/2osB2KEuV/FisSIIsw7m5y2xMdB7RsAGHAfg2lPmp2qKr3KWliVlQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/chai": "^4.3.5",
|
"@types/chai": "^4.3.5",
|
||||||
"@types/chai-subset": "^1.3.3",
|
"@types/chai-subset": "^1.3.3",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@vitest/expect": "0.33.0",
|
"@vitest/expect": "0.34.1",
|
||||||
"@vitest/runner": "0.33.0",
|
"@vitest/runner": "0.34.1",
|
||||||
"@vitest/snapshot": "0.33.0",
|
"@vitest/snapshot": "0.34.1",
|
||||||
"@vitest/spy": "0.33.0",
|
"@vitest/spy": "0.34.1",
|
||||||
"@vitest/utils": "0.33.0",
|
"@vitest/utils": "0.34.1",
|
||||||
"acorn": "^8.9.0",
|
"acorn": "^8.9.0",
|
||||||
"acorn-walk": "^8.2.0",
|
"acorn-walk": "^8.2.0",
|
||||||
"cac": "^6.7.14",
|
"cac": "^6.7.14",
|
||||||
|
@ -4178,9 +4178,9 @@
|
||||||
"std-env": "^3.3.3",
|
"std-env": "^3.3.3",
|
||||||
"strip-literal": "^1.0.1",
|
"strip-literal": "^1.0.1",
|
||||||
"tinybench": "^2.5.0",
|
"tinybench": "^2.5.0",
|
||||||
"tinypool": "^0.6.0",
|
"tinypool": "^0.7.0",
|
||||||
"vite": "^3.0.0 || ^4.0.0",
|
"vite": "^3.0.0 || ^4.0.0",
|
||||||
"vite-node": "0.33.0",
|
"vite-node": "0.34.1",
|
||||||
"why-is-node-running": "^2.2.2"
|
"why-is-node-running": "^2.2.2"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
@ -34,11 +34,11 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/changelog-github": "^0.4.8",
|
"@changesets/changelog-github": "^0.4.8",
|
||||||
"@changesets/cli": "^2.26.2",
|
"@changesets/cli": "^2.26.2",
|
||||||
"@cloudflare/workers-types": "^4.20230710.1",
|
"@cloudflare/workers-types": "^4.20230814.0",
|
||||||
"@types/node": "^20.4.2",
|
"@types/node": "^20.5.0",
|
||||||
"@vercel/ncc": "^0.36.1",
|
"@vercel/ncc": "^0.36.1",
|
||||||
"prettier": "^3.0.0",
|
"prettier": "^3.0.1",
|
||||||
"typescript": "^5.1.6",
|
"typescript": "^5.1.6",
|
||||||
"vitest": "^0.33.0"
|
"vitest": "^0.34.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
43
src/index.ts
43
src/index.ts
|
@ -1,11 +1,12 @@
|
||||||
import {
|
import {
|
||||||
getInput,
|
getInput,
|
||||||
getMultilineInput,
|
getMultilineInput,
|
||||||
info,
|
|
||||||
setFailed,
|
setFailed,
|
||||||
endGroup,
|
info as originalInfo,
|
||||||
startGroup,
|
error as originalError,
|
||||||
error,
|
endGroup as originalEndGroup,
|
||||||
|
startGroup as originalStartGroup,
|
||||||
|
getBooleanInput,
|
||||||
} from "@actions/core";
|
} from "@actions/core";
|
||||||
import { execSync, exec } from "node:child_process";
|
import { execSync, exec } from "node:child_process";
|
||||||
import { existsSync } from "node:fs";
|
import { existsSync } from "node:fs";
|
||||||
|
@ -27,12 +28,37 @@ const config = {
|
||||||
ENVIRONMENT: getInput("environment"),
|
ENVIRONMENT: getInput("environment"),
|
||||||
VARS: getMultilineInput("vars"),
|
VARS: getMultilineInput("vars"),
|
||||||
COMMANDS: getMultilineInput("command"),
|
COMMANDS: getMultilineInput("command"),
|
||||||
|
QUIET_MODE: getBooleanInput("quiet"),
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
function getNpxCmd() {
|
function getNpxCmd() {
|
||||||
return process.env.RUNNER_OS === "Windows" ? "npx.cmd" : "npx";
|
return process.env.RUNNER_OS === "Windows" ? "npx.cmd" : "npx";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function info(message: string, bypass?: boolean): void {
|
||||||
|
if (!config.QUIET_MODE || bypass) {
|
||||||
|
originalInfo(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function error(message: string, bypass?: boolean): void {
|
||||||
|
if (!config.QUIET_MODE || bypass) {
|
||||||
|
originalError(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function startGroup(name: string): void {
|
||||||
|
if (!config.QUIET_MODE) {
|
||||||
|
originalStartGroup(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function endGroup(): void {
|
||||||
|
if (!config.QUIET_MODE) {
|
||||||
|
originalEndGroup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper function to compare two semver versions. If the second arg is greater than the first arg, it returns true.
|
* A helper function to compare two semver versions. If the second arg is greater than the first arg, it returns true.
|
||||||
*/
|
*/
|
||||||
|
@ -60,6 +86,7 @@ async function main() {
|
||||||
await uploadSecrets();
|
await uploadSecrets();
|
||||||
await wranglerCommands();
|
await wranglerCommands();
|
||||||
await execCommands(getMultilineInput("postCommands"), "post");
|
await execCommands(getMultilineInput("postCommands"), "post");
|
||||||
|
info("🏁 Wrangler Action completed", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function runProcess(
|
async function runProcess(
|
||||||
|
@ -70,12 +97,12 @@ async function runProcess(
|
||||||
const result = await execAsync(command, options);
|
const result = await execAsync(command, options);
|
||||||
|
|
||||||
result.stdout && info(result.stdout.toString());
|
result.stdout && info(result.stdout.toString());
|
||||||
result.stderr && error(result.stderr.toString());
|
result.stderr && error(result.stderr.toString(), true);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
err.stdout && info(err.stdout.toString());
|
err.stdout && info(err.stdout.toString());
|
||||||
err.stderr && error(err.stderr.toString());
|
err.stderr && error(err.stderr.toString(), true);
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +132,7 @@ function installWrangler() {
|
||||||
const command = `npm install wrangler@${config["WRANGLER_VERSION"]}`;
|
const command = `npm install wrangler@${config["WRANGLER_VERSION"]}`;
|
||||||
info(`Running command: ${command}`);
|
info(`Running command: ${command}`);
|
||||||
execSync(command, { cwd: config["workingDirectory"], env: process.env });
|
execSync(command, { cwd: config["workingDirectory"], env: process.env });
|
||||||
info(`✅ Wrangler installed`);
|
info(`✅ Wrangler installed`, true);
|
||||||
endGroup();
|
endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,7 +162,7 @@ async function execCommands(commands: string[], cmdType: string) {
|
||||||
|
|
||||||
await Promise.all(arrPromises).catch((result) => {
|
await Promise.all(arrPromises).catch((result) => {
|
||||||
result.stdout && info(result.stdout.toString());
|
result.stdout && info(result.stdout.toString());
|
||||||
result.stderr && error(result.stderr.toString());
|
result.stderr && error(result.stderr.toString(), true);
|
||||||
setFailed(`🚨 ${cmdType}Commands failed`);
|
setFailed(`🚨 ${cmdType}Commands failed`);
|
||||||
});
|
});
|
||||||
endGroup();
|
endGroup();
|
||||||
|
|
7
vitest.config.ts
Normal file
7
vitest.config.ts
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { defineConfig } from "vitest/dist/config";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
test: {
|
||||||
|
setupFiles: ["./action-env-setup.ts"],
|
||||||
|
},
|
||||||
|
});
|
Loading…
Reference in a new issue