From 53b566b16d2aa876f4d725e683ef286929fc389f Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Fri, 11 Jul 2025 15:15:03 -0400 Subject: [PATCH 1/7] Remove bootstrap script call --- CHANGELOG.md | 6 ++++++ bin/local-action.js | 5 ----- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4544363..5bd1364 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## v5 + +Removes support for custom `paths` in the target action's `tsconfig.json`. This +appears to have been causing issues with type-stripping and later versions of +Node.js. + ## v4 This version adds support for diff --git a/bin/local-action.js b/bin/local-action.js index 1562555..2a10ff5 100755 --- a/bin/local-action.js +++ b/bin/local-action.js @@ -32,11 +32,6 @@ function entrypoint() { ? path.join(packagePath, 'src', 'bootstrap.ts').replaceAll('\\', '\\\\') : path.join(packagePath, 'src', 'bootstrap.ts') - // Require the bootstrap script in NODE_OPTIONS. - process.env.NODE_OPTIONS = process.env.NODE_OPTIONS - ? `${process.env.NODE_OPTIONS} --require "${bootstrapPath}"` - : `--require "${bootstrapPath}"` - // Disable experimental warnings. process.env.NODE_NO_WARNINGS = 1 diff --git a/package-lock.json b/package-lock.json index 19d474c..2ba4a1e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@github/local-action", - "version": "4.0.0", + "version": "5.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@github/local-action", - "version": "4.0.0", + "version": "5.0.0", "license": "MIT", "dependencies": { "@actions/artifact": "^2.3.2", diff --git a/package.json b/package.json index 448f778..0610e0c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@github/local-action", "description": "Local Debugging for GitHub Actions", - "version": "4.0.0", + "version": "5.0.0", "type": "module", "author": "Nick Alteen ", "private": false, From ef0a02f3512b534553bb1bde54da12ced2590f7e Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Wed, 16 Jul 2025 14:02:42 -0400 Subject: [PATCH 2/7] Bump version to 5.0.1 and fix help command formatting --- bin/local-action.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/local-action.js b/bin/local-action.js index 2a10ff5..890bbbc 100755 --- a/bin/local-action.js +++ b/bin/local-action.js @@ -55,7 +55,7 @@ function entrypoint() { // If the TARGET_ACTION_PATH environment variable is not set, display the // help message. if (!process.env.TARGET_ACTION_PATH) { - command += `-- --help` + command += ` -- --help` execSync(command, { stdio: 'inherit' }) return } diff --git a/package-lock.json b/package-lock.json index 2ba4a1e..1d805ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@github/local-action", - "version": "5.0.0", + "version": "5.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@github/local-action", - "version": "5.0.0", + "version": "5.0.1", "license": "MIT", "dependencies": { "@actions/artifact": "^2.3.2", diff --git a/package.json b/package.json index 0610e0c..3a8c0aa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@github/local-action", "description": "Local Debugging for GitHub Actions", - "version": "5.0.0", + "version": "5.0.1", "type": "module", "author": "Nick Alteen ", "private": false, From 0b009da539ff5c1db07d7f0d0fc0d6726acfac3c Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Fri, 18 Jul 2025 12:57:34 -0400 Subject: [PATCH 3/7] feat: add bootstrap script requirement to NODE_OPTIONS --- bin/local-action.js | 5 ++++ src/bootstrap.ts | 61 ++++++++++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/bin/local-action.js b/bin/local-action.js index 890bbbc..6994fc1 100755 --- a/bin/local-action.js +++ b/bin/local-action.js @@ -32,6 +32,11 @@ function entrypoint() { ? path.join(packagePath, 'src', 'bootstrap.ts').replaceAll('\\', '\\\\') : path.join(packagePath, 'src', 'bootstrap.ts') + // Require the bootstrap script in NODE_OPTIONS. + process.env.NODE_OPTIONS = process.env.NODE_OPTIONS + ? `${process.env.NODE_OPTIONS} --require "${bootstrapPath}"` + : `--require "${bootstrapPath}"` + // Disable experimental warnings. process.env.NODE_NO_WARNINGS = 1 diff --git a/src/bootstrap.ts b/src/bootstrap.ts index da4c18d..0737dba 100644 --- a/src/bootstrap.ts +++ b/src/bootstrap.ts @@ -9,31 +9,46 @@ * will parse them and register them so that modules can be resolved correctly. */ -const { existsSync, readFileSync } = require('fs') -const { loadConfig, register } = require('tsconfig-paths') -const { parse } = require('comment-json') +import('fs').then(({ existsSync, readFileSync }) => { + import('tsconfig-paths').then(({ loadConfig, register }) => { + import('comment-json').then(({ parse }) => { + import('path').then(({ dirname }) => { + import('url').then(({ fileURLToPath }) => { + if ( + process.env.TARGET_ACTION_PATH && + process.env.TARGET_ACTION_PATH !== '' + ) { + // Check if the action has a `tsconfig.json` file. + if (existsSync(`${process.env.TARGET_ACTION_PATH}/tsconfig.json`)) { + const __dirname = dirname(fileURLToPath(import.meta.url)) -if (process.env.TARGET_ACTION_PATH && process.env.TARGET_ACTION_PATH !== '') { - // Check if the action has a `tsconfig.json` file. - if (existsSync(`${process.env.TARGET_ACTION_PATH}/tsconfig.json`)) { - // Load the `tsconfig.json` from the action directory. - const actionTsConfig = parse( - readFileSync(`${process.env.TARGET_ACTION_PATH}/tsconfig.json`, 'utf-8') - ) + // Load the `tsconfig.json` from the action directory. + const actionTsConfig = parse( + readFileSync( + `${process.env.TARGET_ACTION_PATH}/tsconfig.json`, + 'utf-8' + ) + ) - // Load the current `tsconfig.json` from the root of this directory. - loadConfig(__dirname) + // Load the current `tsconfig.json` from the root of this directory. + loadConfig(__dirname) - // Get the paths from the action's `tsconfig.json`, if any. - const paths = actionTsConfig.compilerOptions?.paths ?? {} + // Get the paths from the action's `tsconfig.json`, if any. + // @ts-expect-error comment-json type mismatch + const paths = actionTsConfig?.compilerOptions?.paths ?? {} - // Add any path mappings from the imported action. Replace the base URL with - // the target action path. - // @todo Should this take into account the previous `baseUrl` value? - register({ - baseUrl: process.env.TARGET_ACTION_PATH, - paths, - addMatchAll: true + // Add any path mappings from the imported action. Replace the base URL with + // the target action path. + // @todo Should this take into account the previous `baseUrl` value? + register({ + baseUrl: process.env.TARGET_ACTION_PATH, + paths, + addMatchAll: true + }) + } + } + }) + }) }) - } -} + }) +}) From 1d50cefe299a7e6f07da498c23ba19bd90284419 Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Fri, 18 Jul 2025 12:57:41 -0400 Subject: [PATCH 4/7] fix: add quiet option to dotenv config --- src/commands/run.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/commands/run.ts b/src/commands/run.ts index cec6c3a..fa1b200 100644 --- a/src/commands/run.ts +++ b/src/commands/run.ts @@ -81,7 +81,8 @@ export async function action( // @todo Load this into EnvMeta directly? What about secrets... config({ path: path.resolve(process.cwd(), dotenvFile), - override: true + override: true, + quiet: true }) // Load action settings From 185c6db496d00e50294d1d8ce0164141f4ba92ff Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Fri, 18 Jul 2025 12:58:39 -0400 Subject: [PATCH 5/7] feat: add CodeQL configuration file and update analysis workflow --- .github/codeql/codeql-config.yml | 7 +++++++ .github/workflows/codeql-analysis.yml | 1 + 2 files changed, 8 insertions(+) create mode 100644 .github/codeql/codeql-config.yml diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 0000000..811683c --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,7 @@ +name: JavaScript CodeQL Configuration + +paths-ignore: + - coverage + - megalinter-reports + - node_modules + - reports diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index de98855..acdd1c4 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,6 +42,7 @@ jobs: with: languages: ${{ matrix.language }} source-root: src + config-file: .github/codeql/codeql-config.yml - name: Autobuild id: autobuild From 51bb32c34565d3d031a82054c90554cc670b6a01 Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Fri, 18 Jul 2025 12:58:44 -0400 Subject: [PATCH 6/7] feat: add Copilot instructions and configuration files --- .github/copilot-instructions.md | 79 +++++++++++++++++++++++++++++++++ .vscode/mcp.json | 9 ++++ .vscode/settings.json | 15 +++++++ 3 files changed, 103 insertions(+) create mode 100644 .github/copilot-instructions.md create mode 100644 .vscode/mcp.json create mode 100644 .vscode/settings.json diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..a025424 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,79 @@ +# Copilot Instructions + +## Environment Setup + +Install dependencies by running: + +```bash +npm install +``` + +## Testing + +Ensure all unit tests pass by running: + +```bash +npm run test +``` + +Unit tests should exist in the `__tests__` directory. They are powered by +`jest`. Fixtures should be placed in the `__fixtures__` directory. + +## General Coding Guidelines + +- Follow standard TypeScript and JavaScript coding conventions and best + practices +- Changes should maintain consistency with existing patterns and style +- Document changes clearly and thoroughly, including updates to existing + comments when appropriate +- Do not include basic, unnecessary comments that simply restate what the code + is doing (focus on explaining _why_, not _what_) +- Use consistent error handling patterns throughout the codebase +- Use TypeScript's type system to ensure type safety and clarity +- Keep functions focused and manageable +- Use descriptive variable and function names that clearly convey their purpose +- Use JSDoc comments to document functions, classes, and complex logic +- After doing any refactoring, ensure to run `npm run test` to ensure that all + tests still pass and coverage requirements are met +- When suggesting code changes, always opt for the most maintainable approach. + Try your best to keep the code clean and follow "Don't Repeat Yourself" (DRY) + principles +- Avoid unnecessary complexity and always consider the long-term maintainability + of the code +- When writing unit tests, try to consider edge cases as well as the main path + of success. This will help ensure that the code is robust and can handle + unexpected inputs or situations + +### Versioning + +GitHub Actions are versioned using branch and tag names. Please ensure the +version in the project's `package.json` is updated to reflect the changes made +in the codebase. The version should follow +[Semantic Versioning](https://semver.org/) principles. + +## Pull Request Guidelines + +When creating a pull request (PR), please ensure that: + +- Keep changes focused and minimal (avoid large changes, or consider breaking + them into separate, smaller PRs) +- Formatting checks pass +- Linting checks pass +- Unit tests pass and coverage requirements are met +- If necessary, the `README.md` file is updated to reflect any changes in + functionality or usage + +The body of the PR should include: + +- A summary of the changes +- A special note of any changes to dependencies +- A link to any relevant issues or discussions +- Any additional context that may be helpful for reviewers + +## Code Review Guidelines + +When performing a code review, please follow these guidelines: + +- If there are changes that modify the functionality/usage of the action, + validate that there are changes in the `README.md` file that document the new + or modified functionality diff --git a/.vscode/mcp.json b/.vscode/mcp.json new file mode 100644 index 0000000..7d7a7c0 --- /dev/null +++ b/.vscode/mcp.json @@ -0,0 +1,9 @@ +{ + "servers": { + "github": { + "url": "https://api.githubcopilot.com/mcp/", + "type": "http" + } + }, + "inputs": [] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..390e031 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,15 @@ +{ + "github.copilot.chat.reviewSelection.instructions": [ + { + "text": "Review the code changes carefully before accepting them." + } + ], + "github.copilot.chat.commitMessageGeneration.instructions": [ + { + "text": "Use conventional commit message format." + } + ], + "github.copilot.chat.pullRequestDescriptionGeneration.instructions": [ + { "text": "Always include a list of key changes." } + ] +} From 09b333f885b0b6bf0be242438ca3fbee521fced4 Mon Sep 17 00:00:00 2001 From: Nick Alteen Date: Fri, 18 Jul 2025 12:59:12 -0400 Subject: [PATCH 7/7] chore: bump version to 5.1.0 in package.json and package-lock.json --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1d805ae..1e99e3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@github/local-action", - "version": "5.0.1", + "version": "5.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@github/local-action", - "version": "5.0.1", + "version": "5.1.0", "license": "MIT", "dependencies": { "@actions/artifact": "^2.3.2", diff --git a/package.json b/package.json index 3a8c0aa..a21e259 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@github/local-action", "description": "Local Debugging for GitHub Actions", - "version": "5.0.1", + "version": "5.1.0", "type": "module", "author": "Nick Alteen ", "private": false, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy