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

Switch to correct input references #112

Merged
merged 2 commits into from
Oct 31, 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 .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{

Check warning on line 1 in .vscode/launch.json

View workflow job for this annotation

GitHub Actions / Lint Codebase

File ignored by default.
"version": "0.2.0",
"configurations": [
{
Expand All @@ -7,7 +7,7 @@
"request": "launch",
"runtimeExecutable": "local-action",
"cwd": "${workspaceRoot}",
"args": [".", "src/index.ts", ".env"],
"args": [".", "src/main.ts", ".env"],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ your updates using the following GitHub Actions repositories:
```bash
npm exec local-action \
"/<action repository clone path>/typescript-action" \
"src/index.ts" \
"src/main.ts" \
"<path to your .env file>"

npm exec local-action \
"/<action repository clone path>/javascript-action" \
"src/index.ts" \
"src/main.ts" \
"<path to your .env file>"
```

Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,31 +149,31 @@ For additional information about transpiled action code, see
| `-h`, `--help` | Display help information |
| `-V`, `--version` | Display version information |

### `local-action run <path> <entrypoint> <dotenv file>`

| Argument | Description |
| ------------- | ---------------------------------------------------- |
| `path` | Path to the local action directory |
| | Example: `/path/to/action.yml` |
| `entrypoint` | Action entrypoint (relative to the action directory) |
| | Example: `src/index.ts` |
| `dotenv file` | Path to the local `.env` file for action inputs |
| | Example: `/path/to/.env` |
| | See the example [`.env.example`](.env.example) |
### `local-action run <path> <logic entrypoint> <dotenv file>`

| Argument | Description |
| ------------------ | ------------------------------------------------------ |
| `path` | Path to the local action directory |
| | Example: `/path/to/action.yml` |
| `logic entrypoint` | Action logic entrypoint (relative to action directory) |
| | Example: `src/main.ts` |
| `dotenv file` | Path to the local `.env` file for action inputs |
| | Example: `/path/to/.env` |
| | See the example [`.env.example`](.env.example) |

Examples:

```bash
local-action run /path/to/typescript-action src/index.ts .env
local-action run /path/to/typescript-action src/main.ts .env

# The `run` action is invoked by default as well
local-action /path/to/typescript-action src/index.ts .env
local-action /path/to/typescript-action src/main.ts .env
```

#### Output

```console
$ local-action run /path/to/typescript-action src/index.ts .env
$ local-action run /path/to/typescript-action src/main.ts .env
_ _ _ ____ _
/ \ ___| |_(_) ___ _ __ | _ \ ___| |__ _ _ __ _ __ _ ___ _ __
/ _ \ / __| __| |/ _ \| '_ \ | | | |/ _ \ '_ \| | | |/ _` |/ _` |/ _ \ '__|
Expand All @@ -188,7 +188,7 @@ $ local-action run /path/to/typescript-action src/index.ts .env
│ (index) │ Field │ Value │
├─────────┼────────────────────┼───────────────────────────────────────────┤
│ 0 │ 'Action Path' │ '/path/to/typescript-action' │
│ 1 │ 'Entrypoint' │ '/path/to/typescript-action/src/index.ts' │
│ 1 │ 'Entrypoint' │ '/path/to/typescript-action/src/main.ts'
│ 2 │ 'Environment File' │ '/path/to/local-action-debugger/.env' │
└─────────┴────────────────────┴───────────────────────────────────────────┘

Expand Down
12 changes: 6 additions & 6 deletions __tests__/command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('Commmand', () => {
).parseAsync(
[
'./__fixtures__/typescript/success',
'src/index.ts',
'src/main.ts',
'./__fixtures__/typescript/success/.env.fixture'
],
{
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('Commmand', () => {
it('Exits if no env-file argument is provided', async () => {
await (
await makeProgram()
).parseAsync(['./__fixtures__/typescript/success', 'src/index.ts'], {
).parseAsync(['./__fixtures__/typescript/success', 'src/main.ts'], {
from: 'user'
})

Expand All @@ -104,7 +104,7 @@ describe('Commmand', () => {
it('Exits if the action path is not a directory', async () => {
await expect(
(await makeProgram()).parseAsync(
['./package.json', 'src/index.ts', '.env'],
['./package.json', 'src/main.ts', '.env'],
{
from: 'user'
}
Expand All @@ -117,7 +117,7 @@ describe('Commmand', () => {
it('Exits if the action path does not exist', async () => {
await expect(
(await makeProgram()).parseAsync(
['/test/path/does/not/exist', 'src/index.ts', '.env'],
['/test/path/does/not/exist', 'src/main.ts', '.env'],
{
from: 'user'
}
Expand All @@ -130,7 +130,7 @@ describe('Commmand', () => {
it('Exits if the action path does not contain an action.yml or action.yaml', async () => {
await expect(
(await makeProgram()).parseAsync(
['./__fixtures__', 'src/index.ts', '.env'],
['./__fixtures__', 'src/main.ts', '.env'],
{
from: 'user'
}
Expand All @@ -156,7 +156,7 @@ describe('Commmand', () => {
it('Throws if the dotenv file does not exist', async () => {
await expect(
(await makeProgram()).parseAsync(
['./__fixtures__/typescript/success', 'src/index.ts', '.notreal.env'],
['./__fixtures__/typescript/success', 'src/main.ts', '.notreal.env'],
{
from: 'user'
}
Expand Down
4 changes: 2 additions & 2 deletions __tests__/stubs/env-stubs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Env', () => {
EnvMeta.actionFile = 'action.yml'
EnvMeta.actionPath = '/some/path'
EnvMeta.dotenvFile = '.env'
EnvMeta.entrypoint = 'index.ts'
EnvMeta.entrypoint = 'main.ts'
EnvMeta.env = { TEST: 'test' }
EnvMeta.inputs = { input: { description: 'test input' } }
EnvMeta.outputs = { output: { description: 'test output' } }
Expand All @@ -49,7 +49,7 @@ describe('Env', () => {
actionFile: 'action.yml',
actionPath: '/some/path',
dotenvFile: '.env',
entrypoint: 'index.ts',
entrypoint: 'main.ts',
env: { TEST: 'test' },
inputs: { input: { description: 'test input' } },
outputs: { output: { description: 'test output' } },
Expand Down
2 changes: 1 addition & 1 deletion docs/debugging-in-vscode.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ action. The following can be used as an example.
"request": "launch",
"runtimeExecutable": "local-action",
"cwd": "${workspaceRoot}",
"args": [".", "src/index.ts", ".env"],
"args": [".", "src/main.ts", ".env"],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**", "node_modules/**"]
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type EnvMetadata = {
/** Outputs defined in `action.yml` */
outputs: { [key: string]: Output }

/** Pre-transpilation entrypoint for the action (e.g. `src/index.ts`) */
/** Pre-transpilation entrypoint for the action (e.g. `src/main.ts`) */
entrypoint: string
}

Expand Down
Loading