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

Fix Node.js 16 runtime deprecation; update to Node 20 #64

Merged
merged 3 commits into from
May 28, 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
10 changes: 5 additions & 5 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Node.js 16.x
uses: actions/setup-node@v3.6.0
- name: Set Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 20.x

- name: Install dependencies
run: npm ci
Expand All @@ -45,7 +45,7 @@ jobs:
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
Expand Down
60 changes: 30 additions & 30 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: 'CodeQL'

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '31 7 * * 3'

Expand All @@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'TypeScript' ]
language: ['TypeScript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
source-root: src
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
source-root: src
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
build: # make sure build/ci work properly
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: |
npm install
- run: |
npm run all
test: # make sure the action works on a clean machine without building
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ./
with:
script: |
Expand Down
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,59 @@
# script-action

_README forthcoming_
An alternative to the official [github-script action][ghs], with some additional features.

[ghs]: https://github.com/actions/github-script#readme

## Usage

See [action.yml](action.yml).

<!-- start usage -->
```yaml
- uses: silverlyra/[email protected]
with:
# JavaScript source to run (or a script filename)
script: >
console.log("Hello, world!");

# Input data to pass into your script
input: 'null'

# If "json", `input` will be parsed as JSON.
# If "string", your script will see the literal string value of `input`.
input-encoding: 'json'

# If "json", the script's return value will be JSON-encoded.
# If "string", the script's return value will be output as a string.
result-encoding: 'json'

# Directory to change into
cwd: '.'

github-token: ${{ github.token }}
```
<!-- end usage -->

## Script

The JavaScript passed as the `script` input will have the following values predefined:

- `input`: The `input` passed to the action, via `with:`
- `env`: An object containing all environment variables (`process.env`)

Scripts also have access to some helper functions:

- `fetch`: The _fetch_ function
- `readEvent`: Read the GitHub event JSON file off of disk; return the event `name` and its `data`
- `shell`: Spawn a process and (optionally) capture its output

These packages are also available:

- `fs`: The Node.js _fs/promises_ module
- `path`: The Node.js _path_ module
- `artifact`: The _@actions/artifact_ NPM package
- `chalk`: The _chalk_ NPM package
- `core`: The _@actions/core_ NPM package
- `exec`: The _@actions/exec_ NPM package
- `glob`: The _@actions/glob_ NPM package
- `io`: The _@actions/io_ NPM package
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ inputs:
description: Input data to make available to your script
default: ''
required: false
github-token:
description: Create an authenticated GitHub client
default: ${{ github.token }}
input-encoding:
description: >-
Use "json" to JSON-decode the "input" input, or "string" to expose the raw
Expand All @@ -33,9 +30,12 @@ inputs:
cwd:
description: Directory to change into
default: '.'
github-token:
description: Create an authenticated GitHub client
default: ${{ github.token }}
outputs:
result:
description: What the script returned, encoded according to "result-encoding"
runs:
using: 'node16'
using: 'node20'
main: 'dist/main.mjs'
68 changes: 0 additions & 68 deletions dist/index-58dbb55b.cjs

This file was deleted.

1 change: 0 additions & 1 deletion dist/index-58dbb55b.cjs.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/index-6f50b7a6.js.map

This file was deleted.

68 changes: 68 additions & 0 deletions dist/index-cf2ca17d.cjs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/index-cf2ca17d.cjs.map

Large diffs are not rendered by default.

Loading