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/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/.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 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." } + ] +} 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..6994fc1 100755 --- a/bin/local-action.js +++ b/bin/local-action.js @@ -60,7 +60,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 19d474c..1e99e3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@github/local-action", - "version": "4.0.0", + "version": "5.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@github/local-action", - "version": "4.0.0", + "version": "5.1.0", "license": "MIT", "dependencies": { "@actions/artifact": "^2.3.2", diff --git a/package.json b/package.json index 448f778..a21e259 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.1.0", "type": "module", "author": "Nick Alteen ", "private": false, 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 + }) + } + } + }) + }) }) - } -} + }) +}) 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 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