Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to require Node.js 20.6.0 #92

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.5.1
20.6.0
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
![Continuous Integration](https://github.com/github/local-action/actions/workflows/continuous-integration.yml/badge.svg)
![Code Coverage](badges/coverage.svg)

Run custom GitHub Actions locally and test them in VS Code!
Run custom GitHub Actions locally and test them in Visual Studio Code!

This command-line tool emulates some **basic** functionality of the
[GitHub Actions Toolkit](https://github.com/actions/toolkit) so that custom
Expand All @@ -14,6 +14,12 @@ actions can be run directly on your workstation.
>
> This tool currently only supports JavaScript and TypeScript actions!

## v2 Changes

As of version `2.0.0`, the `local-action` tool has been updated to require
**Node.js v20.6.0** or higher. This is necessary to support ESM loaders to
override dependencies in the GitHub Actions Toolkit.

## v1 Changes

With the release of `v1.0.0`, there was a need to switch from
Expand Down Expand Up @@ -213,5 +219,5 @@ The following list links to documentation on how to use various features of the
`local-action` tool.

- [Supported Functionality](./docs//supported-functionality.md)
- [Debugging in VS Code](./docs/debugging-in-vscode.md)
- [Debugging in Visual Studio Code](./docs/debugging-in-vscode.md)
- [Create a Job Summary](./docs/create-a-job-summary.md)
50 changes: 30 additions & 20 deletions bin/local-action.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,39 @@ function entrypoint() {
? `${process.env.NODE_OPTIONS} --require ${bootstrapPath}`
: `--require ${bootstrapPath}`

// Disable experimental warnings.
process.env.NODE_NO_WARNINGS = 1

// Start building the command to run local-action.
let command = `npx tsx --loader=quibble "${path.join(packagePath, 'src', 'index.ts')}"`
let command = `npx tsx "${path.join(packagePath, 'src', 'index.ts')}"`

// If there are no input arguments, or the only argument is the help flag,
// display the help message.
if (
process.argv.length === 2 ||
['--help', '-h'].includes(process.argv[2])
) {
command += ` --help`

// Run the command.
execSync(command, { stdio: 'inherit' })
return
}

// Process the input arguments.
if (process.argv.length === 2) {
// No arguments...display the help message.
command += ' --help'
} else {
// Iterate over the arguments and build the command.
for (const arg of process.argv.slice(2)) {
// If the argument is a directory and TARGET_ACTION_PATH is not set, set
// it to the absolute path of the directory. The first directory is the
// target action path.
if (
!process.env.TARGET_ACTION_PATH &&
fs.existsSync(path.resolve(arg)) &&
fs.lstatSync(path.resolve(arg)).isDirectory()
)
process.env.TARGET_ACTION_PATH = path.resolve(arg)
// Iterate over the arguments and build the command.
for (const arg of process.argv.slice(2)) {
// If the argument is a directory and TARGET_ACTION_PATH is not set, set
// it to the absolute path of the directory. The first directory is the
// target action path.
if (
!process.env.TARGET_ACTION_PATH &&
fs.existsSync(path.resolve(arg)) &&
fs.lstatSync(path.resolve(arg)).isDirectory()
)
process.env.TARGET_ACTION_PATH = path.resolve(arg)

// Append the argument to the command.
command += ` ${arg}`
}
// Append the argument to the command.
command += ` ${arg}`
}

// Run the command.
Expand Down
8 changes: 4 additions & 4 deletions docs/debugging-in-vscode.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Debugging in VS Code
# Debugging in Visual Studio Code

This package can also be used with VS Code's built-in debugging tools. You just
need to add a `launch.json` to the project containing your local action. The
following can be used as an example.
This package can also be used with Visual Studio Code's built-in debugging
tools. You just need to add a `launch.json` to the project containing your local
action. The following can be used as an example.

```json
{
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@github/local-action",
"description": "Local Debugging for GitHub Actions",
"version": "2.0.0",
"version": "2.1.0",
"type": "module",
"author": "Nick Alteen <[email protected]>",
"private": false,
Expand Down