Compare commits
32
Commits
v7.1.0
..
3d149a5dc3
@@ -5,7 +5,7 @@ runs:
|
||||
steps:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
node-version: '24.x'
|
||||
cache: npm
|
||||
|
||||
- run: npm ci
|
||||
|
||||
@@ -167,7 +167,7 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
echo "- Validating user-agent set to an empty string"
|
||||
expected="octokit-core.js/"
|
||||
expected="actions/github-script 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
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@actions/github"
|
||||
version: 6.0.0
|
||||
version: 9.1.0
|
||||
type: npm
|
||||
summary: Actions github lib
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: "@actions/http-client"
|
||||
version: 2.2.0
|
||||
type: npm
|
||||
summary: Actions Http Client
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
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 to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
notices: []
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: "@actions/http-client"
|
||||
version: 3.0.2
|
||||
type: npm
|
||||
summary: Actions Http Client
|
||||
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
Actions Http Client for Node.js
|
||||
|
||||
Copyright (c) GitHub, Inc.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
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 to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
notices: []
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/auth-token"
|
||||
version: 4.0.0
|
||||
version: 6.0.0
|
||||
type: npm
|
||||
summary: GitHub API token authentication for browsers and Node.js
|
||||
homepage:
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/core"
|
||||
version: 5.0.1
|
||||
version: 7.0.6
|
||||
type: npm
|
||||
summary: Extendable client for GitHub's REST & GraphQL APIs
|
||||
homepage:
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/endpoint"
|
||||
version: 9.0.0
|
||||
version: 11.0.3
|
||||
type: npm
|
||||
summary: Turns REST API endpoints into generic request options
|
||||
homepage:
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/graphql"
|
||||
version: 7.0.1
|
||||
version: 9.0.3
|
||||
type: npm
|
||||
summary: GitHub GraphQL API client for browsers and Node
|
||||
homepage:
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@octokit/openapi-types"
|
||||
version: 27.0.0
|
||||
type: npm
|
||||
summary: Generated TypeScript definitions based on GitHub's OpenAPI spec for api.github.com
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |-
|
||||
Copyright 2020 Gregor Martynus
|
||||
|
||||
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 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/plugin-paginate-rest"
|
||||
version: 9.0.0
|
||||
version: 14.0.0
|
||||
type: npm
|
||||
summary: Octokit plugin to paginate REST API endpoint responses
|
||||
homepage:
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/plugin-request-log"
|
||||
version: 4.0.0
|
||||
version: 6.0.0
|
||||
type: npm
|
||||
summary: Log all requests and request errors
|
||||
homepage:
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/plugin-rest-endpoint-methods"
|
||||
version: 10.0.1
|
||||
version: 17.0.0
|
||||
type: npm
|
||||
summary: Octokit plugin adding one method for all of api.github.com REST API endpoints
|
||||
homepage:
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/plugin-retry"
|
||||
version: 6.0.1
|
||||
version: 8.1.0
|
||||
type: npm
|
||||
summary: Automatic retry plugin for octokit
|
||||
homepage:
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/request-error"
|
||||
version: 5.0.0
|
||||
version: 7.1.0
|
||||
type: npm
|
||||
summary: Error class for Octokit request errors
|
||||
homepage:
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@octokit/request"
|
||||
version: 8.1.1
|
||||
version: 10.0.8
|
||||
type: npm
|
||||
summary: Send parameterized requests to GitHub's APIs with sensible defaults in browsers
|
||||
and Node
|
||||
|
||||
Generated
+20
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "@octokit/types"
|
||||
version: 16.0.0
|
||||
type: npm
|
||||
summary: Shared TypeScript definitions for Octokit projects
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License Copyright (c) 2019 Octokit 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 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
- sources: README.md
|
||||
text: "[MIT](LICENSE)"
|
||||
notices: []
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: "@types/node"
|
||||
version: 20.9.0
|
||||
version: 24.1.0
|
||||
type: npm
|
||||
summary: TypeScript definitions for node
|
||||
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node
|
||||
|
||||
Generated
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: before-after-hook
|
||||
version: 2.2.2
|
||||
version: 4.0.0
|
||||
type: npm
|
||||
summary: asynchronous before/error/after hooks for internal functionality
|
||||
homepage: https://github.com/gr2m/before-after-hook#readme
|
||||
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: fast-content-type-parse
|
||||
version: 3.0.0
|
||||
type: npm
|
||||
summary: Parse HTTP Content-Type header according to RFC 7231
|
||||
homepage: https://github.com/fastify/fast-content-type-parse#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Fastify
|
||||
|
||||
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
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
notices: []
|
||||
Generated
+32
@@ -0,0 +1,32 @@
|
||||
---
|
||||
name: json-with-bigint
|
||||
version: 3.5.8
|
||||
type: npm
|
||||
summary: JSON parser/stringifier with BigInt support
|
||||
homepage: https://github.com/nickytonline/json-with-bigint#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
text: |
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023
|
||||
|
||||
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
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
notices: []
|
||||
Generated
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: undici
|
||||
version: 5.28.5
|
||||
type: npm
|
||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||
homepage: https://undici.nodejs.org
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
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
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
- sources: README.md
|
||||
text: MIT
|
||||
notices: []
|
||||
Generated
+34
@@ -0,0 +1,34 @@
|
||||
---
|
||||
name: undici
|
||||
version: 6.24.1
|
||||
type: npm
|
||||
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||
homepage: https://undici.nodejs.org
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE
|
||||
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
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
- sources: README.md
|
||||
text: MIT
|
||||
notices: []
|
||||
Generated
+4
-2
@@ -1,15 +1,17 @@
|
||||
---
|
||||
name: undici-types
|
||||
version: 5.26.5
|
||||
version: 7.8.0
|
||||
type: npm
|
||||
summary: A stand-alone types package for Undici
|
||||
homepage: https://undici.nodejs.org
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
- sources: LICENSE
|
||||
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
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: universal-user-agent
|
||||
version: 6.0.0
|
||||
version: 7.0.3
|
||||
type: npm
|
||||
summary: Get a user agent string in both browser and node
|
||||
homepage: https://github.com/gr2m/universal-user-agent#readme
|
||||
|
||||
@@ -53,6 +53,14 @@ 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
|
||||
@@ -91,7 +99,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@v7
|
||||
- uses: actions/github-script@v8
|
||||
env:
|
||||
TITLE: ${{ github.event.pull_request.title }}
|
||||
with:
|
||||
@@ -110,7 +118,7 @@ The return value of the script will be in the step's outputs under the
|
||||
"result" key.
|
||||
|
||||
```yaml
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
id: set-result
|
||||
with:
|
||||
script: return "Hello!"
|
||||
@@ -129,7 +137,7 @@ output of a github-script step. For some workflows, string encoding is preferred
|
||||
`result-encoding` input:
|
||||
|
||||
```yaml
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
id: my-script
|
||||
with:
|
||||
result-encoding: string
|
||||
@@ -141,7 +149,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@v7
|
||||
- uses: actions/github-script@v8
|
||||
id: my-script
|
||||
with:
|
||||
result-encoding: string
|
||||
@@ -159,7 +167,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@v7
|
||||
- uses: actions/github-script@v8
|
||||
id: my-script
|
||||
with:
|
||||
result-encoding: string
|
||||
@@ -188,7 +196,7 @@ By default, github-script will use the token provided to your workflow.
|
||||
|
||||
```yaml
|
||||
- name: View context attributes
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: console.log(context)
|
||||
```
|
||||
@@ -204,7 +212,7 @@ jobs:
|
||||
comment:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
@@ -226,7 +234,7 @@ jobs:
|
||||
apply-label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
github.rest.issues.addLabels({
|
||||
@@ -248,7 +256,7 @@ jobs:
|
||||
welcome:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
// Get a list of all issues created by the PR opener
|
||||
@@ -293,7 +301,7 @@ jobs:
|
||||
diff:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const diff_url = context.payload.pull_request.diff_url
|
||||
@@ -317,7 +325,7 @@ jobs:
|
||||
list-issues:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const query = `query($owner:String!, $name:String!, $label:String!) {
|
||||
@@ -351,7 +359,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const script = require('./path/to/script.js')
|
||||
@@ -389,7 +397,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
env:
|
||||
SHA: '${{env.parentSHA}}'
|
||||
with:
|
||||
@@ -433,7 +441,7 @@ jobs:
|
||||
- run: npm ci
|
||||
# or one-off:
|
||||
- run: npm install execa
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const execa = require('execa')
|
||||
@@ -463,7 +471,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const { default: printStuff } = await import('${{ github.workspace }}/src/print-stuff.js')
|
||||
@@ -507,7 +515,7 @@ jobs:
|
||||
apply-label:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
github-token: ${{ secrets.MY_PAT }}
|
||||
script: |
|
||||
@@ -531,7 +539,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const exitCode = await exec.exec('echo', ['hello'])
|
||||
@@ -549,7 +557,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/github-script@v7
|
||||
- uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const {
|
||||
|
||||
@@ -8,6 +8,94 @@ describe('callAsyncFunction', () => {
|
||||
expect(result).toEqual('bar')
|
||||
})
|
||||
|
||||
test('passes getOctokit through the script context', async () => {
|
||||
const getOctokit = jest.fn().mockReturnValue('secondary-client')
|
||||
|
||||
const result = await callAsyncFunction(
|
||||
{getOctokit} as any,
|
||||
"return getOctokit('token')"
|
||||
)
|
||||
|
||||
expect(getOctokit).toHaveBeenCalledWith('token')
|
||||
expect(result).toEqual('secondary-client')
|
||||
})
|
||||
|
||||
test('getOctokit creates client independent from github', async () => {
|
||||
const github = {rest: {issues: 'primary'}}
|
||||
const getOctokit = jest.fn().mockReturnValue({rest: {issues: 'secondary'}})
|
||||
|
||||
const result = await callAsyncFunction(
|
||||
{github, getOctokit} as any,
|
||||
`
|
||||
const secondary = getOctokit('other-token')
|
||||
return {
|
||||
primary: github.rest.issues,
|
||||
secondary: secondary.rest.issues,
|
||||
different: github !== secondary
|
||||
}
|
||||
`
|
||||
)
|
||||
|
||||
expect(result).toEqual({
|
||||
primary: 'primary',
|
||||
secondary: 'secondary',
|
||||
different: true
|
||||
})
|
||||
expect(getOctokit).toHaveBeenCalledWith('other-token')
|
||||
})
|
||||
|
||||
test('getOctokit passes options through', async () => {
|
||||
const getOctokit = jest.fn().mockReturnValue('client-with-opts')
|
||||
|
||||
const result = await callAsyncFunction(
|
||||
{getOctokit} as any,
|
||||
`return getOctokit('my-token', { baseUrl: 'https://ghes.example.com/api/v3' })`
|
||||
)
|
||||
|
||||
expect(getOctokit).toHaveBeenCalledWith('my-token', {
|
||||
baseUrl: 'https://ghes.example.com/api/v3'
|
||||
})
|
||||
expect(result).toEqual('client-with-opts')
|
||||
})
|
||||
|
||||
test('getOctokit supports plugins', async () => {
|
||||
const getOctokit = jest.fn().mockReturnValue('client-with-plugins')
|
||||
|
||||
const result = await callAsyncFunction(
|
||||
{getOctokit} as any,
|
||||
`return getOctokit('my-token', { previews: ['v3'] }, 'pluginA', 'pluginB')`
|
||||
)
|
||||
|
||||
expect(getOctokit).toHaveBeenCalledWith(
|
||||
'my-token',
|
||||
{previews: ['v3']},
|
||||
'pluginA',
|
||||
'pluginB'
|
||||
)
|
||||
expect(result).toEqual('client-with-plugins')
|
||||
})
|
||||
|
||||
test('multiple getOctokit calls produce independent clients', async () => {
|
||||
const getOctokit = jest
|
||||
.fn()
|
||||
.mockReturnValueOnce({id: 'client-a'})
|
||||
.mockReturnValueOnce({id: 'client-b'})
|
||||
|
||||
const result = await callAsyncFunction(
|
||||
{getOctokit} as any,
|
||||
`
|
||||
const a = getOctokit('token-a')
|
||||
const b = getOctokit('token-b')
|
||||
return { a: a.id, b: b.id, different: a !== b }
|
||||
`
|
||||
)
|
||||
|
||||
expect(getOctokit).toHaveBeenCalledTimes(2)
|
||||
expect(getOctokit).toHaveBeenNthCalledWith(1, 'token-a')
|
||||
expect(getOctokit).toHaveBeenNthCalledWith(2, 'token-b')
|
||||
expect(result).toEqual({a: 'client-a', b: 'client-b', different: true})
|
||||
})
|
||||
|
||||
test('throws on ReferenceError', async () => {
|
||||
expect.assertions(1)
|
||||
|
||||
@@ -25,4 +113,22 @@ describe('callAsyncFunction', () => {
|
||||
test('can access console', async () => {
|
||||
await callAsyncFunction({} as any, 'console')
|
||||
})
|
||||
|
||||
test('injected names are accessible when not redeclared', async () => {
|
||||
const getOctokit = jest.fn().mockReturnValue('from-injected')
|
||||
|
||||
const result = await callAsyncFunction(
|
||||
{getOctokit} as any,
|
||||
`return getOctokit('token')`
|
||||
)
|
||||
|
||||
expect(result).toEqual('from-injected')
|
||||
expect(getOctokit).toHaveBeenCalledWith('token')
|
||||
})
|
||||
|
||||
test('syntax errors in user code still throw', () => {
|
||||
expect(() => callAsyncFunction({} as any, 'const x = {')).toThrow(
|
||||
SyntaxError
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -0,0 +1,288 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
|
||||
import {createConfiguredGetOctokit} from '../src/create-configured-getoctokit'
|
||||
|
||||
describe('createConfiguredGetOctokit', () => {
|
||||
const mockRetryPlugin = jest.fn()
|
||||
const mockRequestLogPlugin = jest.fn()
|
||||
|
||||
function makeMockGetOctokit() {
|
||||
return jest.fn().mockReturnValue('mock-client')
|
||||
}
|
||||
|
||||
test('passes token and merged defaults to underlying getOctokit', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {
|
||||
userAgent: 'actions/github-script actions_orchestration_id/abc',
|
||||
retry: {enabled: true},
|
||||
request: {retries: 3}
|
||||
}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(
|
||||
raw as any,
|
||||
defaults,
|
||||
mockRetryPlugin,
|
||||
mockRequestLogPlugin
|
||||
)
|
||||
wrapped('my-token' as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'my-token',
|
||||
expect.objectContaining({
|
||||
userAgent: 'actions/github-script actions_orchestration_id/abc',
|
||||
retry: {enabled: true},
|
||||
request: {retries: 3}
|
||||
}),
|
||||
mockRetryPlugin,
|
||||
mockRequestLogPlugin
|
||||
)
|
||||
})
|
||||
|
||||
test('user options override top-level defaults', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {
|
||||
userAgent: 'default-agent',
|
||||
previews: ['v3']
|
||||
}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any, {userAgent: 'custom-agent'} as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'tok',
|
||||
expect.objectContaining({userAgent: 'custom-agent', previews: ['v3']})
|
||||
)
|
||||
})
|
||||
|
||||
test('deep-merges request so partial overrides preserve retries', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {
|
||||
request: {retries: 3, agent: 'proxy-agent', fetch: 'proxy-fetch'}
|
||||
}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any, {request: {timeout: 5000}} as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'tok',
|
||||
expect.objectContaining({
|
||||
request: {
|
||||
retries: 3,
|
||||
agent: 'proxy-agent',
|
||||
fetch: 'proxy-fetch',
|
||||
timeout: 5000
|
||||
}
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
test('deep-merges retry so partial overrides preserve existing settings', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {
|
||||
retry: {enabled: true, retries: 3}
|
||||
}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any, {retry: {retries: 5}} as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'tok',
|
||||
expect.objectContaining({
|
||||
retry: {enabled: true, retries: 5}
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
test('user can override request.retries explicitly', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {request: {retries: 3}}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any, {request: {retries: 0}} as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'tok',
|
||||
expect.objectContaining({request: {retries: 0}})
|
||||
)
|
||||
})
|
||||
|
||||
test('user plugins are appended after default plugins', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const customPlugin = jest.fn()
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(
|
||||
raw as any,
|
||||
{},
|
||||
mockRetryPlugin,
|
||||
mockRequestLogPlugin
|
||||
)
|
||||
wrapped('tok' as any, {} as any, customPlugin as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'tok',
|
||||
expect.any(Object),
|
||||
mockRetryPlugin,
|
||||
mockRequestLogPlugin,
|
||||
customPlugin
|
||||
)
|
||||
})
|
||||
|
||||
test('duplicate plugins are deduplicated', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(
|
||||
raw as any,
|
||||
{},
|
||||
mockRetryPlugin,
|
||||
mockRequestLogPlugin
|
||||
)
|
||||
// User passes retry again — should not duplicate
|
||||
wrapped('tok' as any, {} as any, mockRetryPlugin as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'tok',
|
||||
expect.any(Object),
|
||||
mockRetryPlugin,
|
||||
mockRequestLogPlugin
|
||||
)
|
||||
})
|
||||
|
||||
test('applies defaults when no user options provided', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {
|
||||
userAgent: 'actions/github-script',
|
||||
retry: {enabled: true},
|
||||
request: {retries: 3}
|
||||
}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(
|
||||
raw as any,
|
||||
defaults,
|
||||
mockRetryPlugin
|
||||
)
|
||||
wrapped('tok' as any)
|
||||
|
||||
expect(raw).toHaveBeenCalledWith(
|
||||
'tok',
|
||||
{
|
||||
userAgent: 'actions/github-script',
|
||||
retry: {enabled: true},
|
||||
request: {retries: 3}
|
||||
},
|
||||
mockRetryPlugin
|
||||
)
|
||||
})
|
||||
|
||||
test('baseUrl: undefined from user does not clobber default', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {baseUrl: 'https://ghes.example.com/api/v3'}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any, {baseUrl: undefined} as any)
|
||||
|
||||
const calledOpts = raw.mock.calls[0][1]
|
||||
expect(calledOpts.baseUrl).toBe('https://ghes.example.com/api/v3')
|
||||
})
|
||||
|
||||
test('undefined values in nested request are stripped', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {request: {retries: 3, agent: 'proxy'}}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any, {request: {retries: undefined, timeout: 5000}} as any)
|
||||
|
||||
const calledOpts = raw.mock.calls[0][1]
|
||||
expect(calledOpts.request).toEqual({
|
||||
retries: 3,
|
||||
agent: 'proxy',
|
||||
timeout: 5000
|
||||
})
|
||||
})
|
||||
|
||||
test('undefined values in nested retry are stripped', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {retry: {enabled: true, retries: 3}}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any, {retry: {enabled: undefined, retries: 5}} as any)
|
||||
|
||||
const calledOpts = raw.mock.calls[0][1]
|
||||
expect(calledOpts.retry).toEqual({enabled: true, retries: 5})
|
||||
})
|
||||
|
||||
test('each call creates an independent client', () => {
|
||||
const raw = jest
|
||||
.fn()
|
||||
.mockReturnValueOnce('client-a')
|
||||
.mockReturnValueOnce('client-b')
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, {})
|
||||
const a = wrapped('token-a' as any)
|
||||
const b = wrapped('token-b' as any)
|
||||
|
||||
expect(a).toBe('client-a')
|
||||
expect(b).toBe('client-b')
|
||||
expect(raw).toHaveBeenCalledTimes(2)
|
||||
})
|
||||
|
||||
test('does not mutate defaultOptions between calls', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {
|
||||
request: {retries: 3},
|
||||
retry: {enabled: true}
|
||||
}
|
||||
const originalDefaults = JSON.parse(JSON.stringify(defaults))
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped(
|
||||
'tok' as any,
|
||||
{request: {timeout: 5000}, retry: {retries: 10}} as any
|
||||
)
|
||||
wrapped('tok' as any, {request: {timeout: 9000}} as any)
|
||||
|
||||
expect(defaults).toEqual(originalDefaults)
|
||||
})
|
||||
|
||||
test('undefined values in defaults are stripped (e.g. log: undefined)', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {
|
||||
userAgent: 'actions/github-script',
|
||||
log: undefined,
|
||||
previews: undefined,
|
||||
retry: {enabled: true}
|
||||
}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped('tok' as any)
|
||||
|
||||
const calledOpts = raw.mock.calls[0][1]
|
||||
expect(calledOpts.userAgent).toBe('actions/github-script')
|
||||
expect(calledOpts.retry).toEqual({enabled: true})
|
||||
// undefined defaults should be stripped, not passed through
|
||||
expect('log' in calledOpts).toBe(false)
|
||||
expect('previews' in calledOpts).toBe(false)
|
||||
})
|
||||
|
||||
test('falsy-but-valid values are preserved, only undefined is stripped', () => {
|
||||
const raw = makeMockGetOctokit()
|
||||
const defaults = {baseUrl: 'https://ghes.example.com/api/v3'}
|
||||
|
||||
const wrapped = createConfiguredGetOctokit(raw as any, defaults)
|
||||
wrapped(
|
||||
'tok' as any,
|
||||
{
|
||||
log: null,
|
||||
retries: 0,
|
||||
debug: false,
|
||||
userAgent: ''
|
||||
} as any
|
||||
)
|
||||
|
||||
const calledOpts = raw.mock.calls[0][1]
|
||||
expect(calledOpts.log).toBeNull()
|
||||
expect(calledOpts.retries).toBe(0)
|
||||
expect(calledOpts.debug).toBe(false)
|
||||
expect(calledOpts.userAgent).toBe('')
|
||||
expect(calledOpts.baseUrl).toBe('https://ghes.example.com/api/v3')
|
||||
})
|
||||
})
|
||||
+1
-1
@@ -36,5 +36,5 @@ outputs:
|
||||
result:
|
||||
description: The return value of the script, stringified with `JSON.stringify`
|
||||
runs:
|
||||
using: node20
|
||||
using: node24
|
||||
main: dist/index.js
|
||||
|
||||
Vendored
+17
-1
@@ -36267,9 +36267,11 @@ 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: userAgent || undefined,
|
||||
userAgent: finalUserAgent,
|
||||
previews: previews ? previews.split(',') : undefined,
|
||||
retry: retryOpts,
|
||||
request: requestOpts
|
||||
@@ -36313,6 +36315,20 @@ 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}`;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user