-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR converts `local-action` to ESM, as well as adds support for JavaScript/TypeScript actions written in ESM syntax. This is accomplished by replacing proxyquire with quibble, which allows for stubbing out both CommonJS and ESM packages with less issues.
- Loading branch information
Showing
87 changed files
with
1,202 additions
and
896 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
21.6.2 | ||
20.5.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { jest } from '@jest/globals' | ||
|
||
export const debug = jest.fn().mockImplementation(() => {}) | ||
export const error = jest.fn().mockImplementation(() => {}) | ||
export const info = jest.fn().mockImplementation(() => {}) | ||
export const getInput = jest.fn().mockImplementation(() => {}) | ||
export const setOutput = jest.fn().mockImplementation(() => {}) | ||
export const setFailed = jest.fn().mockImplementation(() => {}) | ||
export const warning = jest.fn().mockImplementation(() => {}) | ||
export const summary = { | ||
addRaw: jest.fn().mockImplementation(() => {}), | ||
write: jest.fn().mockImplementation(() => {}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ACTIONS_STEP_DEBUG=false | ||
INPUT_MILLISECONDS=2400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: JavaScript (No Import) | ||
description: This action doesn't import any dependencies | ||
|
||
inputs: | ||
myInput: | ||
description: An input | ||
required: true | ||
default: value | ||
|
||
outputs: | ||
myOutput: | ||
description: An output | ||
|
||
runs: | ||
using: node20 | ||
main: dist/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "javascript-action", | ||
"description": "GitHub Actions JavaScript template", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.1" | ||
}, | ||
"devDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { run } = require('./main') | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
async function run() { | ||
return Promise.resolve() | ||
} | ||
|
||
module.exports = { | ||
run | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ACTIONS_STEP_DEBUG=false | ||
INPUT_MILLISECONDS=2400 |
4 changes: 2 additions & 2 deletions
4
...res__/typescript/success-yaml/action.yaml → ...tures__/javascript-esm/success/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"name": "javascript-action", | ||
"description": "GitHub Actions JavaScript template", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.1" | ||
}, | ||
"devDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { run } = require('./main') | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const { getInput, info, setOutput } = require('@actions/core') | ||
|
||
async function run() { | ||
const myInput = getInput('myInput') | ||
|
||
setOutput('myOutput', myInput) | ||
|
||
info('JavaScript Action Succeeded!') | ||
} | ||
|
||
module.exports = { | ||
run | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,2 @@ | ||
# Do not commit your actual .env file to Git! This may contain secrets or other | ||
# private information. | ||
|
||
# GitHub Actions inputs should follow `INPUT_<name>` format (case-insensitive). | ||
INPUT_milliseconds=2400 | ||
|
||
# Enable/disable step debug logs | ||
ACTIONS_STEP_DEBUG=false | ||
ACTIONS_STEP_DEBUG=false | ||
INPUT_MILLISECONDS=2400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "javascript-action", | ||
"description": "GitHub Actions JavaScript template", | ||
"version": "0.0.0", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.1" | ||
}, | ||
"devDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/no-floating-promises */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
/* eslint-disable import/no-commonjs */ | ||
|
||
const { run } = require('./main') | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
/* eslint-disable import/no-commonjs */ | ||
|
||
async function run() { | ||
return Promise.resolve() | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,2 @@ | ||
# Do not commit your actual .env file to Git! This may contain secrets or other | ||
# private information. | ||
|
||
# GitHub Actions inputs should follow `INPUT_<name>` format (case-insensitive). | ||
INPUT_milliseconds=2400 | ||
|
||
# Enable/disable step debug logs | ||
ACTIONS_STEP_DEBUG=false | ||
|
||
# Step summary output location | ||
GITHUB_STEP_SUMMARY='summary.md' | ||
INPUT_MILLISECONDS=2400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "javascript-action", | ||
"description": "GitHub Actions JavaScript template", | ||
"version": "0.0.0", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.1" | ||
}, | ||
"devDependencies": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/no-floating-promises */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
/* eslint-disable import/no-commonjs */ | ||
|
||
const { run } = require('./main') | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { jest } from '@jest/globals' | ||
|
||
export const loadConfig = jest.fn().mockImplementation(() => {}) | ||
export const register = jest.fn().mockImplementation(() => {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ACTIONS_STEP_DEBUG=false | ||
INPUT_MILLISECONDS=2400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: The name of your action here | ||
description: Provide a description here | ||
author: Your name or organization here | ||
|
||
inputs: | ||
milliseconds: | ||
description: Your input description here | ||
required: true | ||
default: '1000' | ||
|
||
outputs: | ||
time: | ||
description: Your output description here | ||
|
||
runs: | ||
using: node20 | ||
main: dist/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "typescript-action", | ||
"description": "GitHub Actions TypeScript template", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.14.7", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.5.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { run } from './main.js' | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export async function run(): Promise<void> { | ||
console.log('TypeScript ESM Action (no-import)!') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/tsconfig", | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"declaration": true, | ||
"declarationMap": false, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"lib": ["ES2022"], | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"newLine": "lf", | ||
"noImplicitAny": true, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": false, | ||
"pretty": true, | ||
"resolveJsonModule": true, | ||
"sourceMap": true, | ||
"strict": true, | ||
"strictNullChecks": true, | ||
"target": "ES2022" | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ACTIONS_STEP_DEBUG=false | ||
INPUT_MILLISECONDS=2400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: The name of your action here | ||
description: Provide a description here | ||
author: Your name or organization here | ||
|
||
inputs: | ||
milliseconds: | ||
description: Your input description here | ||
required: true | ||
default: '1000' | ||
|
||
outputs: | ||
time: | ||
description: Your output description here | ||
|
||
runs: | ||
using: node20 | ||
main: dist/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "typescript-action", | ||
"description": "GitHub Actions TypeScript template", | ||
"version": "0.0.0", | ||
"type": "module", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"dependencies": { | ||
"@actions/core": "^1.10.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.14.7", | ||
"ts-node": "^10.9.2", | ||
"typescript": "^5.5.2" | ||
} | ||
} |
Oops, something went wrong.