@ronaldphilipsen/local-action 0.0.0-stage → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.checkov.yml +3 -0
- package/.env.example +379 -0
- package/.github/codeql/codeql-config.yml +7 -0
- package/.github/copilot-instructions.md +79 -0
- package/.github/dependabot.yml +32 -0
- package/.github/workflows/codeql-analysis.yml +53 -0
- package/.github/workflows/continuous-delivery.yml +93 -0
- package/.github/workflows/continuous-integration.yml +382 -0
- package/.github/workflows/linter.yml +47 -0
- package/.github/workflows/release.yaml +99 -0
- package/.github/workflows/version-check.yml +44 -0
- package/.grype.yml +151 -0
- package/.markdown-lint.yml +7 -0
- package/.mega-linter.yml +188 -0
- package/.node-version +1 -0
- package/.prettierignore +4 -0
- package/.prettierrc.yml +14 -0
- package/.vscode/launch.json +15 -0
- package/.vscode/mcp.json +9 -0
- package/.vscode/settings.json +15 -0
- package/.vscode/tasks.json +51 -0
- package/.yaml-lint.yml +10 -0
- package/CHANGELOG.md +75 -0
- package/CODEOWNERS +3 -0
- package/CODE_OF_CONDUCT.md +74 -0
- package/CONTRIBUTING.md +140 -0
- package/LICENSE +21 -0
- package/README.md +285 -2
- package/SECURITY.md +42 -0
- package/SUPPORT.md +19 -0
- package/__fixtures__/@actions/core.ts +14 -0
- package/__fixtures__/@actions/exec.ts +9 -0
- package/__fixtures__/@actions/github.ts +3 -0
- package/__fixtures__/@actions/http-client.ts +9 -0
- package/__fixtures__/@actions/io.ts +9 -0
- package/__fixtures__/@octokit/rest.ts +18 -0
- package/__fixtures__/crypto.ts +7 -0
- package/__fixtures__/fs.ts +27 -0
- package/__fixtures__/javascript/no-export/.env.fixture +2 -0
- package/__fixtures__/javascript/no-export/action.yml +16 -0
- package/__fixtures__/javascript/no-export/node_modules/.gitkeep +0 -0
- package/__fixtures__/javascript/no-export/package.json +12 -0
- package/__fixtures__/javascript/no-export/src/index.js +0 -0
- package/__fixtures__/javascript/no-export/src/main.js +0 -0
- package/__fixtures__/javascript/no-import/.env.fixture +2 -0
- package/__fixtures__/javascript/no-import/action.yml +16 -0
- package/__fixtures__/javascript/no-import/node_modules/.gitkeep +0 -0
- package/__fixtures__/javascript/no-import/package.json +12 -0
- package/__fixtures__/javascript/no-import/src/index.js +3 -0
- package/__fixtures__/javascript/no-import/src/main.js +7 -0
- package/__fixtures__/javascript/success/.env.fixture +2 -0
- package/__fixtures__/javascript/success/action.yml +16 -0
- package/__fixtures__/javascript/success/node_modules/.gitkeep +0 -0
- package/__fixtures__/javascript/success/package.json +12 -0
- package/__fixtures__/javascript/success/post/index.js +3 -0
- package/__fixtures__/javascript/success/post/main.js +13 -0
- package/__fixtures__/javascript/success/pre/index.js +3 -0
- package/__fixtures__/javascript/success/pre/main.js +13 -0
- package/__fixtures__/javascript/success/src/index.js +3 -0
- package/__fixtures__/javascript/success/src/main.js +13 -0
- package/__fixtures__/javascript-esm/no-import/.env.fixture +2 -0
- package/__fixtures__/javascript-esm/no-import/action.yml +16 -0
- package/__fixtures__/javascript-esm/no-import/node_modules/.gitkeep +0 -0
- package/__fixtures__/javascript-esm/no-import/package.json +13 -0
- package/__fixtures__/javascript-esm/no-import/src/index.js +3 -0
- package/__fixtures__/javascript-esm/no-import/src/main.js +7 -0
- package/__fixtures__/javascript-esm/success/.env.fixture +2 -0
- package/__fixtures__/javascript-esm/success/action.yml +16 -0
- package/__fixtures__/javascript-esm/success/node_modules/.gitkeep +0 -0
- package/__fixtures__/javascript-esm/success/package.json +13 -0
- package/__fixtures__/javascript-esm/success/post/index.js +3 -0
- package/__fixtures__/javascript-esm/success/post/main.js +13 -0
- package/__fixtures__/javascript-esm/success/pre/index.js +3 -0
- package/__fixtures__/javascript-esm/success/pre/main.js +13 -0
- package/__fixtures__/javascript-esm/success/src/index.js +3 -0
- package/__fixtures__/javascript-esm/success/src/main.js +13 -0
- package/__fixtures__/path.ts +7 -0
- package/__fixtures__/payloads/issue_opened.json +33 -0
- package/__fixtures__/stream/promises.ts +3 -0
- package/__fixtures__/tsconfig-paths.ts +4 -0
- package/__fixtures__/typescript/no-import/.env.fixture +2 -0
- package/__fixtures__/typescript/no-import/action.yml +16 -0
- package/__fixtures__/typescript/no-import/node_modules/.gitkeep +0 -0
- package/__fixtures__/typescript/no-import/package.json +15 -0
- package/__fixtures__/typescript/no-import/src/index.ts +3 -0
- package/__fixtures__/typescript/no-import/src/main.ts +3 -0
- package/__fixtures__/typescript/no-import/tsconfig.json +20 -0
- package/__fixtures__/typescript/success/.env.fixture +2 -0
- package/__fixtures__/typescript/success/action.yml +16 -0
- package/__fixtures__/typescript/success/node_modules/.gitkeep +0 -0
- package/__fixtures__/typescript/success/package.json +15 -0
- package/__fixtures__/typescript/success/post/index.ts +3 -0
- package/__fixtures__/typescript/success/post/main.ts +9 -0
- package/__fixtures__/typescript/success/pre/index.ts +3 -0
- package/__fixtures__/typescript/success/pre/main.ts +9 -0
- package/__fixtures__/typescript/success/src/index.ts +3 -0
- package/__fixtures__/typescript/success/src/main.ts +9 -0
- package/__fixtures__/typescript/success/tsconfig.json +20 -0
- package/__fixtures__/typescript/success-yaml/.env.fixture +2 -0
- package/__fixtures__/typescript/success-yaml/action.yaml +16 -0
- package/__fixtures__/typescript/success-yaml/node_modules/.gitkeep +0 -0
- package/__fixtures__/typescript/success-yaml/package.json +15 -0
- package/__fixtures__/typescript/success-yaml/post/index.ts +3 -0
- package/__fixtures__/typescript/success-yaml/post/main.ts +9 -0
- package/__fixtures__/typescript/success-yaml/pre/index.ts +3 -0
- package/__fixtures__/typescript/success-yaml/pre/main.ts +9 -0
- package/__fixtures__/typescript/success-yaml/src/index.ts +3 -0
- package/__fixtures__/typescript/success-yaml/src/main.ts +9 -0
- package/__fixtures__/typescript/success-yaml/tsconfig.json +20 -0
- package/__fixtures__/typescript-esm/no-export/.env.fixture +2 -0
- package/__fixtures__/typescript-esm/no-export/action.yml +17 -0
- package/__fixtures__/typescript-esm/no-export/node_modules/.gitkeep +0 -0
- package/__fixtures__/typescript-esm/no-export/package.json +17 -0
- package/__fixtures__/typescript-esm/no-export/src/index.ts +0 -0
- package/__fixtures__/typescript-esm/no-export/src/main.ts +0 -0
- package/__fixtures__/typescript-esm/no-export/tsconfig.json +25 -0
- package/__fixtures__/typescript-esm/no-import/.env.fixture +2 -0
- package/__fixtures__/typescript-esm/no-import/action.yml +17 -0
- package/__fixtures__/typescript-esm/no-import/node_modules/.gitkeep +0 -0
- package/__fixtures__/typescript-esm/no-import/package.json +17 -0
- package/__fixtures__/typescript-esm/no-import/src/index.ts +3 -0
- package/__fixtures__/typescript-esm/no-import/src/main.ts +3 -0
- package/__fixtures__/typescript-esm/no-import/tsconfig.json +25 -0
- package/__fixtures__/typescript-esm/success/.env.fixture +2 -0
- package/__fixtures__/typescript-esm/success/action.yml +17 -0
- package/__fixtures__/typescript-esm/success/node_modules/.gitkeep +0 -0
- package/__fixtures__/typescript-esm/success/package.json +17 -0
- package/__fixtures__/typescript-esm/success/post/index.ts +3 -0
- package/__fixtures__/typescript-esm/success/post/main.ts +9 -0
- package/__fixtures__/typescript-esm/success/pre/index.ts +3 -0
- package/__fixtures__/typescript-esm/success/pre/main.ts +9 -0
- package/__fixtures__/typescript-esm/success/src/index.ts +3 -0
- package/__fixtures__/typescript-esm/success/src/main.ts +9 -0
- package/__fixtures__/typescript-esm/success/tsconfig.json +25 -0
- package/__fixtures__/typescript-esm/tsconfig-comments/.env.fixture +2 -0
- package/__fixtures__/typescript-esm/tsconfig-comments/action.yml +17 -0
- package/__fixtures__/typescript-esm/tsconfig-comments/node_modules/.gitkeep +0 -0
- package/__fixtures__/typescript-esm/tsconfig-comments/package.json +17 -0
- package/__fixtures__/typescript-esm/tsconfig-comments/src/index.ts +3 -0
- package/__fixtures__/typescript-esm/tsconfig-comments/src/main.ts +9 -0
- package/__fixtures__/typescript-esm/tsconfig-comments/tsconfig.json +21 -0
- package/__tests__/command.test.ts +224 -0
- package/__tests__/stubs/artifact/internal/client.test.ts +340 -0
- package/__tests__/stubs/artifact/internal/delete/delete-artifact.test.ts +152 -0
- package/__tests__/stubs/artifact/internal/download/download-artifact.test.ts +119 -0
- package/__tests__/stubs/artifact/internal/find/get-artifact.test.ts +237 -0
- package/__tests__/stubs/artifact/internal/find/list-artifacts.test.ts +218 -0
- package/__tests__/stubs/artifact/internal/find/retry-options.test.ts +54 -0
- package/__tests__/stubs/artifact/internal/shared/config.test.ts +91 -0
- package/__tests__/stubs/artifact/internal/shared/errors.test.ts +38 -0
- package/__tests__/stubs/artifact/internal/shared/user-agent.test.ts +22 -0
- package/__tests__/stubs/artifact/internal/upload/path-and-artifact-name-validation.test.ts +53 -0
- package/__tests__/stubs/artifact/internal/upload/upload-artifact.test.ts +126 -0
- package/__tests__/stubs/artifact/internal/upload/upload-zip-specification.test.ts +49 -0
- package/__tests__/stubs/cache/cache.test.ts +357 -0
- package/__tests__/stubs/cache/errors.test.ts +55 -0
- package/__tests__/stubs/cache/internal/cacheUtils.test.ts +109 -0
- package/__tests__/stubs/cache/internal/constants.test.ts +81 -0
- package/__tests__/stubs/cache/internal/tar.test.ts +129 -0
- package/__tests__/stubs/core/core.test.ts +760 -0
- package/__tests__/stubs/core/path-utils.test.ts +45 -0
- package/__tests__/stubs/core/platform.test.ts +89 -0
- package/__tests__/stubs/core/summary.test.ts +455 -0
- package/__tests__/stubs/env.test.ts +72 -0
- package/__tests__/stubs/github/context.test.ts +73 -0
- package/__tests__/stubs/github/github.test.ts +15 -0
- package/__tests__/stubs/github/internal/utils.test.ts +98 -0
- package/__tests__/stubs/github/utils.test.ts +16 -0
- package/__tests__/utils/config.test.ts +78 -0
- package/__tests__/utils/output.test.ts +32 -0
- package/__tests__/utils/package.test.ts +33 -0
- package/badges/coverage.svg +1 -0
- package/bin/local-action.js +121 -0
- package/docs/create-a-job-summary.md +32 -0
- package/docs/debugging-in-vscode.md +27 -0
- package/docs/img/job-summary.png +0 -0
- package/docs/supported-functionality.md +126 -0
- package/eslint.config.mjs +74 -0
- package/jest.config.ts +41 -0
- package/package.json +93 -4
- package/src/command.ts +171 -0
- package/src/commands/run.ts +616 -0
- package/src/index.ts +21 -0
- package/src/stubs/artifact/artifact.ts +17 -0
- package/src/stubs/artifact/internal/client.ts +400 -0
- package/src/stubs/artifact/internal/delete/delete-artifact.ts +126 -0
- package/src/stubs/artifact/internal/download/download-artifact.ts +309 -0
- package/src/stubs/artifact/internal/find/get-artifact.ts +135 -0
- package/src/stubs/artifact/internal/find/list-artifacts.ts +188 -0
- package/src/stubs/artifact/internal/find/retry-options.ts +57 -0
- package/src/stubs/artifact/internal/shared/config.ts +64 -0
- package/src/stubs/artifact/internal/shared/errors.ts +53 -0
- package/src/stubs/artifact/internal/shared/interfaces.ts +195 -0
- package/src/stubs/artifact/internal/shared/user-agent.ts +13 -0
- package/src/stubs/artifact/internal/upload/path-and-artifact-name-validation.ts +92 -0
- package/src/stubs/artifact/internal/upload/upload-artifact.ts +127 -0
- package/src/stubs/artifact/internal/upload/upload-zip-specification.ts +108 -0
- package/src/stubs/artifact/internal/upload/zip.ts +122 -0
- package/src/stubs/cache/cache.ts +334 -0
- package/src/stubs/cache/errors.ts +31 -0
- package/src/stubs/cache/interfaces.ts +4 -0
- package/src/stubs/cache/internal/cacheUtils.ts +207 -0
- package/src/stubs/cache/internal/constants.ts +45 -0
- package/src/stubs/cache/internal/tar.ts +374 -0
- package/src/stubs/cache/options.ts +91 -0
- package/src/stubs/core/core.ts +743 -0
- package/src/stubs/core/path-utils.ts +39 -0
- package/src/stubs/core/platform.ts +132 -0
- package/src/stubs/core/summary.ts +399 -0
- package/src/stubs/env.ts +40 -0
- package/src/stubs/github/context.ts +94 -0
- package/src/stubs/github/github.ts +29 -0
- package/src/stubs/github/interfaces.ts +52 -0
- package/src/stubs/github/internal/utils.ts +83 -0
- package/src/stubs/github/utils.ts +52 -0
- package/src/types/quibble.d.ts +5 -0
- package/src/types.ts +116 -0
- package/src/utils/config.ts +47 -0
- package/src/utils/output.ts +20 -0
- package/src/utils/package.ts +38 -0
- package/tsconfig.base.json +29 -0
- package/tsconfig.eslint.json +22 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: The name of your action here
|
|
2
|
+
description: Provide a description here
|
|
3
|
+
author: Your name or organization here
|
|
4
|
+
|
|
5
|
+
inputs:
|
|
6
|
+
milliseconds:
|
|
7
|
+
description: Your input description here
|
|
8
|
+
required: true
|
|
9
|
+
default: '1000'
|
|
10
|
+
|
|
11
|
+
outputs:
|
|
12
|
+
time:
|
|
13
|
+
description: Your output description here
|
|
14
|
+
|
|
15
|
+
runs:
|
|
16
|
+
using: node20
|
|
17
|
+
main: dist/index.js
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typescript-action",
|
|
3
|
+
"description": "GitHub Actions TypeScript template",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@actions/core": "^2.0.2"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/node": "^22.14.1",
|
|
14
|
+
"ts-node": "^10.9.2",
|
|
15
|
+
"typescript": "^5.6.3"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": false,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"lib": ["ES2022"],
|
|
10
|
+
"module": "NodeNext",
|
|
11
|
+
"moduleResolution": "NodeNext",
|
|
12
|
+
"newLine": "lf",
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"noUnusedLocals": true,
|
|
15
|
+
"noUnusedParameters": false,
|
|
16
|
+
"pretty": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"sourceMap": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"strictNullChecks": true,
|
|
21
|
+
"target": "ES2022"
|
|
22
|
+
},
|
|
23
|
+
"exclude": ["node_modules"],
|
|
24
|
+
"include": ["src"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: The name of your action here
|
|
2
|
+
description: Provide a description here
|
|
3
|
+
author: Your name or organization here
|
|
4
|
+
|
|
5
|
+
inputs:
|
|
6
|
+
milliseconds:
|
|
7
|
+
description: Your input description here
|
|
8
|
+
required: true
|
|
9
|
+
default: '1000'
|
|
10
|
+
|
|
11
|
+
outputs:
|
|
12
|
+
time:
|
|
13
|
+
description: Your output description here
|
|
14
|
+
|
|
15
|
+
runs:
|
|
16
|
+
using: node20
|
|
17
|
+
main: dist/index.js
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typescript-action",
|
|
3
|
+
"description": "GitHub Actions TypeScript template",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@actions/core": "^2.0.2"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/node": "^20.14.7",
|
|
14
|
+
"ts-node": "^10.9.2",
|
|
15
|
+
"typescript": "^5.6.3"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": false,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"lib": ["ES2022"],
|
|
10
|
+
"module": "NodeNext",
|
|
11
|
+
"moduleResolution": "NodeNext",
|
|
12
|
+
"newLine": "lf",
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"noUnusedLocals": true,
|
|
15
|
+
"noUnusedParameters": false,
|
|
16
|
+
"pretty": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"sourceMap": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"strictNullChecks": true,
|
|
21
|
+
"target": "ES2022"
|
|
22
|
+
},
|
|
23
|
+
"exclude": ["node_modules"],
|
|
24
|
+
"include": ["src"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: The name of your action here
|
|
2
|
+
description: Provide a description here
|
|
3
|
+
author: Your name or organization here
|
|
4
|
+
|
|
5
|
+
inputs:
|
|
6
|
+
milliseconds:
|
|
7
|
+
description: Your input description here
|
|
8
|
+
required: true
|
|
9
|
+
default: '1000'
|
|
10
|
+
|
|
11
|
+
outputs:
|
|
12
|
+
time:
|
|
13
|
+
description: Your output description here
|
|
14
|
+
|
|
15
|
+
runs:
|
|
16
|
+
using: node20
|
|
17
|
+
main: dist/index.js
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typescript-action",
|
|
3
|
+
"description": "GitHub Actions TypeScript template",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@actions/core": "^2.0.2"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/node": "^22.14.1",
|
|
14
|
+
"ts-node": "^10.9.2",
|
|
15
|
+
"typescript": "^5.6.3"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": false,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"lib": ["ES2022"],
|
|
10
|
+
"module": "NodeNext",
|
|
11
|
+
"moduleResolution": "NodeNext",
|
|
12
|
+
"newLine": "lf",
|
|
13
|
+
"noImplicitAny": true,
|
|
14
|
+
"noUnusedLocals": true,
|
|
15
|
+
"noUnusedParameters": false,
|
|
16
|
+
"pretty": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"sourceMap": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"strictNullChecks": true,
|
|
21
|
+
"target": "ES2022"
|
|
22
|
+
},
|
|
23
|
+
"exclude": ["node_modules"],
|
|
24
|
+
"include": ["src"]
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: The name of your action here
|
|
2
|
+
description: Provide a description here
|
|
3
|
+
author: Your name or organization here
|
|
4
|
+
|
|
5
|
+
inputs:
|
|
6
|
+
milliseconds:
|
|
7
|
+
description: Your input description here
|
|
8
|
+
required: true
|
|
9
|
+
default: '1000'
|
|
10
|
+
|
|
11
|
+
outputs:
|
|
12
|
+
time:
|
|
13
|
+
description: Your output description here
|
|
14
|
+
|
|
15
|
+
runs:
|
|
16
|
+
using: node20
|
|
17
|
+
main: dist/index.js
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "typescript-action",
|
|
3
|
+
"description": "GitHub Actions TypeScript template",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@actions/core": "^2.0.2"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@types/node": "^22.14.1",
|
|
14
|
+
"ts-node": "^10.9.2",
|
|
15
|
+
"typescript": "^5.6.3"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
3
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
6
|
+
"module": "NodeNext" /* Specify what module code is generated. */,
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"moduleResolution": "NodeNext" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
9
|
+
"baseUrl": "./",
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
12
|
+
"noImplicitAny": true,
|
|
13
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
14
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
15
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
16
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
|
|
17
|
+
"newLine": "lf"
|
|
18
|
+
},
|
|
19
|
+
"exclude": ["node_modules"],
|
|
20
|
+
"include": ["src"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { jest } from '@jest/globals'
|
|
2
|
+
import { Command } from 'commander'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
import { ResetCoreMetadata } from '../src/stubs/core/core.js'
|
|
5
|
+
import { EnvMeta, ResetEnvMetadata } from '../src/stubs/env.js'
|
|
6
|
+
|
|
7
|
+
const action = jest.fn()
|
|
8
|
+
|
|
9
|
+
jest.unstable_mockModule('../src/commands/run.js', () => {
|
|
10
|
+
return {
|
|
11
|
+
action
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const process_exitSpy = jest.spyOn(process, 'exit').mockImplementation(() => {
|
|
16
|
+
throw new Error(`process.exit()`)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const { makeProgram } = await import('../src/command.js')
|
|
20
|
+
|
|
21
|
+
describe('Commmand', () => {
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
// Reset metadata
|
|
24
|
+
ResetEnvMetadata()
|
|
25
|
+
ResetCoreMetadata()
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
afterEach(() => {
|
|
29
|
+
jest.resetAllMocks()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('makeProgram()', () => {
|
|
33
|
+
it('Returns a Program', async () => {
|
|
34
|
+
const program = await makeProgram()
|
|
35
|
+
|
|
36
|
+
expect(program).not.toBe(null)
|
|
37
|
+
expect(program).toBeInstanceOf(Command)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('Has a run command', async () => {
|
|
41
|
+
const program = await makeProgram()
|
|
42
|
+
|
|
43
|
+
expect(program.commands.find(c => c.name() === 'run')).toBeInstanceOf(
|
|
44
|
+
Command
|
|
45
|
+
)
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('Runs if all arguments are provided (action.yml)', async () => {
|
|
49
|
+
const program = await makeProgram()
|
|
50
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__/typescript/success')
|
|
51
|
+
|
|
52
|
+
program.parse(
|
|
53
|
+
[
|
|
54
|
+
'./__fixtures__/typescript/success',
|
|
55
|
+
'src/main.ts',
|
|
56
|
+
'./__fixtures__/typescript/success/.env.fixture',
|
|
57
|
+
'--pre',
|
|
58
|
+
'pre/main.ts',
|
|
59
|
+
'--post',
|
|
60
|
+
'post/main.ts'
|
|
61
|
+
],
|
|
62
|
+
{
|
|
63
|
+
from: 'user'
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
expect(action).toHaveBeenCalled()
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('Runs if all arguments are provided (action.yaml)', async () => {
|
|
71
|
+
const program = await makeProgram()
|
|
72
|
+
EnvMeta.actionPath = path.resolve(
|
|
73
|
+
'./__fixtures__/typescript/success-yaml'
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
program.parse(
|
|
77
|
+
[
|
|
78
|
+
'./__fixtures__/typescript/success-yaml',
|
|
79
|
+
'src/main.ts',
|
|
80
|
+
'./__fixtures__/typescript/success-yaml/.env.fixture',
|
|
81
|
+
'--pre',
|
|
82
|
+
'pre/main.ts',
|
|
83
|
+
'--post',
|
|
84
|
+
'post/main.ts'
|
|
85
|
+
],
|
|
86
|
+
{
|
|
87
|
+
from: 'user'
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
expect(action).toHaveBeenCalled()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('Exits if no path argument is provided', async () => {
|
|
95
|
+
const program = await makeProgram()
|
|
96
|
+
|
|
97
|
+
program.parse([], { from: 'user' })
|
|
98
|
+
|
|
99
|
+
expect(process_exitSpy).toHaveBeenCalled()
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('Exits if no entrypoint argument is provided', async () => {
|
|
103
|
+
const program = await makeProgram()
|
|
104
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__/typescript/success')
|
|
105
|
+
|
|
106
|
+
program.parse(['./__fixtures__/typescript/success', ''], { from: 'user' })
|
|
107
|
+
|
|
108
|
+
expect(process_exitSpy).toHaveBeenCalled()
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('Exits if no env-file argument is provided', async () => {
|
|
112
|
+
const program = await makeProgram()
|
|
113
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__/typescript/success')
|
|
114
|
+
|
|
115
|
+
program.parse(['./__fixtures__/typescript/success', 'src/main.ts'], {
|
|
116
|
+
from: 'user'
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
expect(process_exitSpy).toHaveBeenCalled()
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it('Exits if the action path is not a directory', async () => {
|
|
123
|
+
const program = await makeProgram()
|
|
124
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__/typescript/success')
|
|
125
|
+
|
|
126
|
+
expect(() => {
|
|
127
|
+
program.parse(['./package.json', 'src/main.ts', '.env'], {
|
|
128
|
+
from: 'user'
|
|
129
|
+
})
|
|
130
|
+
}).toThrow('Action path must be a directory')
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it('Exits if the action path does not exist', async () => {
|
|
134
|
+
const program = await makeProgram()
|
|
135
|
+
EnvMeta.actionPath = path.resolve('/test/path/does/not/exist')
|
|
136
|
+
|
|
137
|
+
expect(() => {
|
|
138
|
+
program.parse(['/test/path/does/not/exist', 'src/main.ts', '.env'], {
|
|
139
|
+
from: 'user'
|
|
140
|
+
})
|
|
141
|
+
}).toThrow('Action path does not exist')
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
it('Exits if the action path does not contain an action.yml or action.yaml', async () => {
|
|
145
|
+
const program = await makeProgram()
|
|
146
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__')
|
|
147
|
+
|
|
148
|
+
expect(() => {
|
|
149
|
+
program.parse(['./__fixtures__', 'src/main.ts', '.env'], {
|
|
150
|
+
from: 'user'
|
|
151
|
+
})
|
|
152
|
+
}).toThrow('Path must contain an action.yml / action.yaml file')
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
it('Exits if the entrypoint does not exist', async () => {
|
|
156
|
+
const program = await makeProgram()
|
|
157
|
+
|
|
158
|
+
expect(() => {
|
|
159
|
+
program.parse(
|
|
160
|
+
['./__fixtures__/typescript/success', 'src/fake.ts', '.env'],
|
|
161
|
+
{
|
|
162
|
+
from: 'user'
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
}).toThrow('Entrypoint does not exist')
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
it('Exits if the pre entrypoint does not exist', async () => {
|
|
169
|
+
const program = await makeProgram()
|
|
170
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__/typescript/success')
|
|
171
|
+
|
|
172
|
+
expect(() => {
|
|
173
|
+
program.parse(
|
|
174
|
+
[
|
|
175
|
+
'./__fixtures__/typescript/success',
|
|
176
|
+
'src/main.ts',
|
|
177
|
+
'./__fixtures__/typescript/success/.env.fixture',
|
|
178
|
+
'--pre',
|
|
179
|
+
'pre/fake.ts'
|
|
180
|
+
],
|
|
181
|
+
{
|
|
182
|
+
from: 'user'
|
|
183
|
+
}
|
|
184
|
+
)
|
|
185
|
+
}).toThrow('PRE entrypoint does not exist')
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
it('Exits if the post entrypoint does not exist', async () => {
|
|
189
|
+
const program = await makeProgram()
|
|
190
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__/typescript/success')
|
|
191
|
+
|
|
192
|
+
expect(() => {
|
|
193
|
+
program.parse(
|
|
194
|
+
[
|
|
195
|
+
'./__fixtures__/typescript/success',
|
|
196
|
+
'src/main.ts',
|
|
197
|
+
'./__fixtures__/typescript/success/.env.fixture',
|
|
198
|
+
'--pre',
|
|
199
|
+
'pre/main.ts',
|
|
200
|
+
'--post',
|
|
201
|
+
'post/fake.ts'
|
|
202
|
+
],
|
|
203
|
+
{
|
|
204
|
+
from: 'user'
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
}).toThrow('POST entrypoint does not exist')
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
it('Throws if the dotenv file does not exist', async () => {
|
|
211
|
+
const program = await makeProgram()
|
|
212
|
+
EnvMeta.actionPath = path.resolve('./__fixtures__/typescript/success')
|
|
213
|
+
|
|
214
|
+
expect(() => {
|
|
215
|
+
program.parse(
|
|
216
|
+
['./__fixtures__/typescript/success', 'src/main.ts', '.notreal.env'],
|
|
217
|
+
{
|
|
218
|
+
from: 'user'
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
}).toThrow('Environment file does not exist')
|
|
222
|
+
})
|
|
223
|
+
})
|
|
224
|
+
})
|