Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
9bebb5f048 Bump undici from 5.28.5 to 5.29.0
Bumps [undici](https://github.com/nodejs/undici) from 5.28.5 to 5.29.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.5...v5.29.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 5.29.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-15 16:31:19 +00:00
10 changed files with 54 additions and 120 deletions

View File

@@ -5,7 +5,7 @@ runs:
steps:
- uses: actions/setup-node@v4
with:
node-version: '24.x'
node-version: '20.x'
cache: npm
- run: npm ci

View File

@@ -167,7 +167,7 @@ jobs:
exit 1
fi
echo "- Validating user-agent set to an empty string"
expected="actions/github-script octokit-core.js/"
expected="octokit-core.js/"
if [[ "${{steps.user-agent-empty.outputs.result}}" != "$expected"* ]]; then
echo $'::error::\u274C' "Expected user-agent to start with '$expected', got ${{steps.user-agent-empty.outputs.result}}"
exit 1

View File

@@ -1,6 +1,6 @@
---
name: "@types/node"
version: 24.1.0
version: 20.9.0
type: npm
summary: TypeScript definitions for node
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node

View File

@@ -1,17 +1,15 @@
---
name: undici-types
version: 7.8.0
version: 5.26.5
type: npm
summary: A stand-alone types package for Undici
homepage: https://undici.nodejs.org
license: mit
licenses:
- sources: LICENSE
- sources: Auto-generated MIT license text
text: |
MIT License
Copyright (c) Matteo Collina and Undici contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights

View File

@@ -7,26 +7,6 @@
This action makes it easy to quickly write a script in your workflow that
uses the GitHub API and the workflow run context.
### Note
Thank you for your interest in this GitHub action, however, right now we are not taking contributions.
We continue to focus our resources on strategic areas that help our customers be successful while making developers' lives easier. While GitHub Actions remains a key part of this vision, we are allocating resources towards other areas of Actions and are not taking contributions to this repository at this time. The GitHub public roadmap is the best place to follow along for any updates on features were working on and what stage theyre in.
We are taking the following steps to better direct requests related to GitHub Actions, including:
1. We will be directing questions and support requests to our [Community Discussions area](https://github.com/orgs/community/discussions/categories/actions)
2. High Priority bugs can be reported through Community Discussions or you can report these to our support team https://support.github.com/contact/bug-report.
3. Security Issues should be handled as per our [security.md](security.md)
We will still provide security updates for this project and fix major breaking changes during this time.
You are welcome to still raise bugs in this repo.
### This action
To use this action, provide an input named `script` that contains the body of an asynchronous JavaScript function call.
The following arguments will be provided:
@@ -53,14 +33,6 @@ documentation.
## Breaking Changes
### V8
Version 8 of this action updated the runtime to Node 24 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions
All scripts are now run with Node 24 instead of Node 20 and are affected by any breaking changes between Node 20 and 24.
**This requires a minimum Actions Runner version of [v2.327.1](https://github.com/actions/runner/releases/tag/v2.327.1)**
### V7
Version 7 of this action updated the runtime to Node 20 - https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-javascript-actions
@@ -99,7 +71,7 @@ and potential `SyntaxError`s when the expression is not valid JavaScript code (p
To pass inputs, set `env` vars on the action step and reference them in your script with `process.env`:
```yaml
- uses: actions/github-script@v8
- uses: actions/github-script@v7
env:
TITLE: ${{ github.event.pull_request.title }}
with:
@@ -118,7 +90,7 @@ The return value of the script will be in the step's outputs under the
"result" key.
```yaml
- uses: actions/github-script@v8
- uses: actions/github-script@v7
id: set-result
with:
script: return "Hello!"
@@ -137,7 +109,7 @@ output of a github-script step. For some workflows, string encoding is preferred
`result-encoding` input:
```yaml
- uses: actions/github-script@v8
- uses: actions/github-script@v7
id: my-script
with:
result-encoding: string
@@ -149,7 +121,7 @@ output of a github-script step. For some workflows, string encoding is preferred
By default, requests made with the `github` instance will not be retried. You can configure this with the `retries` option:
```yaml
- uses: actions/github-script@v8
- uses: actions/github-script@v7
id: my-script
with:
result-encoding: string
@@ -167,7 +139,7 @@ In this example, request failures from `github.rest.issues.get()` will be retrie
You can also configure which status codes should be exempt from retries via the `retry-exempt-status-codes` option:
```yaml
- uses: actions/github-script@v8
- uses: actions/github-script@v7
id: my-script
with:
result-encoding: string
@@ -196,7 +168,7 @@ By default, github-script will use the token provided to your workflow.
```yaml
- name: View context attributes
uses: actions/github-script@v8
uses: actions/github-script@v7
with:
script: console.log(context)
```
@@ -212,7 +184,7 @@ jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
@@ -234,7 +206,7 @@ jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
github.rest.issues.addLabels({
@@ -256,7 +228,7 @@ jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
// Get a list of all issues created by the PR opener
@@ -301,7 +273,7 @@ jobs:
diff:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
const diff_url = context.payload.pull_request.diff_url
@@ -325,7 +297,7 @@ jobs:
list-issues:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
const query = `query($owner:String!, $name:String!, $label:String!) {
@@ -359,7 +331,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
const script = require('./path/to/script.js')
@@ -397,7 +369,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v8
- uses: actions/github-script@v7
env:
SHA: '${{env.parentSHA}}'
with:
@@ -441,7 +413,7 @@ jobs:
- run: npm ci
# or one-off:
- run: npm install execa
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
const execa = require('execa')
@@ -471,7 +443,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
const { default: printStuff } = await import('${{ github.workspace }}/src/print-stuff.js')
@@ -515,7 +487,7 @@ jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.MY_PAT }}
script: |
@@ -539,7 +511,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
const exitCode = await exec.exec('echo', ['hello'])
@@ -557,7 +529,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v8
- uses: actions/github-script@v7
with:
script: |
const {

View File

@@ -36,5 +36,5 @@ outputs:
result:
description: The return value of the script, stringified with `JSON.stringify`
runs:
using: node24
using: node20
main: dist/index.js

18
dist/index.js vendored
View File

@@ -36267,11 +36267,9 @@ async function main() {
const retries = parseInt(core.getInput('retries'));
const exemptStatusCodes = parseNumberArray(core.getInput('retry-exempt-status-codes'));
const [retryOpts, requestOpts] = getRetryOptions(retries, exemptStatusCodes, utils.defaults);
const baseUserAgent = userAgent || 'actions/github-script';
const finalUserAgent = getUserAgentWithOrchestrationId(baseUserAgent);
const opts = {
log: debug ? console : undefined,
userAgent: finalUserAgent,
userAgent: userAgent || undefined,
previews: previews ? previews.split(',') : undefined,
retry: retryOpts,
request: requestOpts
@@ -36315,20 +36313,6 @@ function handleError(err) {
console.error(err);
core.setFailed(`Unhandled error: ${err}`);
}
/**
* Gets the user agent string with orchestration ID appended if available
* @param userAgent The base user agent string
* @returns The user agent string with orchestration ID appended if ACTIONS_ORCHESTRATION_ID is set
*/
function getUserAgentWithOrchestrationId(userAgent) {
const orchestrationId = process.env['ACTIONS_ORCHESTRATION_ID'];
if (!orchestrationId) {
return userAgent;
}
// Sanitize orchestration ID - replace invalid characters with underscore
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_');
return `${userAgent} actions_orchestration_id/${sanitized}`;
}
})();

47
package-lock.json generated
View File

@@ -17,7 +17,7 @@
"@octokit/core": "^5.0.1",
"@octokit/plugin-request-log": "^4.0.0",
"@octokit/plugin-retry": "^6.0.1",
"@types/node": "^24.1.0"
"@types/node": "^20.9.0"
},
"devDependencies": {
"@types/jest": "^29.5.5",
@@ -35,7 +35,7 @@
"typescript": "^5.2.2"
},
"engines": {
"node": ">=24"
"node": ">=20.0.0 <21.0.0"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
@@ -1672,12 +1672,11 @@
"dev": true
},
"node_modules/@types/node": {
"version": "24.1.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
"integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
"license": "MIT",
"version": "20.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz",
"integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==",
"dependencies": {
"undici-types": "~7.8.0"
"undici-types": "~5.26.4"
}
},
"node_modules/@types/semver": {
@@ -7103,9 +7102,10 @@
}
},
"node_modules/undici": {
"version": "5.28.5",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
"version": "5.29.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},
@@ -7114,10 +7114,9 @@
}
},
"node_modules/undici-types": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
"license": "MIT"
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
"node_modules/universal-user-agent": {
"version": "6.0.0",
@@ -8654,11 +8653,11 @@
"dev": true
},
"@types/node": {
"version": "24.1.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
"integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
"version": "20.9.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz",
"integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==",
"requires": {
"undici-types": "~7.8.0"
"undici-types": "~5.26.4"
}
},
"@types/semver": {
@@ -12536,17 +12535,17 @@
}
},
"undici": {
"version": "5.28.5",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
"version": "5.29.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
"requires": {
"@fastify/busboy": "^2.0.0"
}
},
"undici-types": {
"version": "7.8.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
"integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA=="
},
"universal-user-agent": {
"version": "6.0.0",

View File

@@ -1,14 +1,15 @@
{
"name": "@actions/github-script",
"description": "A GitHub action for executing a simple script",
"engines": {
"node": ">=24"
},
"version": "7.0.1",
"author": "GitHub",
"license": "MIT",
"main": "dist/index.js",
"types": "types/async-function.d.ts",
"private": true,
"engines": {
"node": ">=20.0.0 <21.0.0"
},
"scripts": {
"build": "npm run build:types && ncc build src/main.ts",
"build:types": "tsc src/async-function.ts -t es5 --declaration --allowJs --emitDeclarationOnly --outDir types",
@@ -46,7 +47,7 @@
"@octokit/core": "^5.0.1",
"@octokit/plugin-request-log": "^4.0.0",
"@octokit/plugin-retry": "^6.0.1",
"@types/node": "^24.1.0"
"@types/node": "^20.9.0"
},
"devDependencies": {
"@types/jest": "^29.5.5",

View File

@@ -39,12 +39,9 @@ async function main(): Promise<void> {
defaultGitHubOptions
)
const baseUserAgent = userAgent || 'actions/github-script'
const finalUserAgent = getUserAgentWithOrchestrationId(baseUserAgent)
const opts: Options = {
log: debug ? console : undefined,
userAgent: finalUserAgent,
userAgent: userAgent || undefined,
previews: previews ? previews.split(',') : undefined,
retry: retryOpts,
request: requestOpts
@@ -99,20 +96,3 @@ function handleError(err: any): void {
console.error(err)
core.setFailed(`Unhandled error: ${err}`)
}
/**
* Gets the user agent string with orchestration ID appended if available
* @param userAgent The base user agent string
* @returns The user agent string with orchestration ID appended if ACTIONS_ORCHESTRATION_ID is set
*/
function getUserAgentWithOrchestrationId(userAgent: string): string {
const orchestrationId = process.env['ACTIONS_ORCHESTRATION_ID']
if (!orchestrationId) {
return userAgent
}
// Sanitize orchestration ID - replace invalid characters with underscore
const sanitized = orchestrationId.replace(/[^a-zA-Z0-9._-]/g, '_')
return `${userAgent} actions_orchestration_id/${sanitized}`
}