mirror of
https://github.com/actions/github-script.git
synced 2025-12-08 08:06:23 +00:00
Merge pull request #288 from luketomlinson/main
Add retry plugin and related options
This commit is contained in:
2
.licenses/npm/@actions/github.dep.yml
generated
2
.licenses/npm/@actions/github.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/github"
|
name: "@actions/github"
|
||||||
version: 5.0.0
|
version: 5.1.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions github lib
|
summary: Actions github lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
homepage: https://github.com/actions/toolkit/tree/main/packages/github
|
||||||
|
|||||||
32
.licenses/npm/@actions/http-client-1.0.11.dep.yml
generated
32
.licenses/npm/@actions/http-client-1.0.11.dep.yml
generated
@@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@actions/http-client"
|
|
||||||
version: 1.0.11
|
|
||||||
type: npm
|
|
||||||
summary: Actions Http Client
|
|
||||||
homepage: https://github.com/actions/http-client#readme
|
|
||||||
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
.licenses/npm/@actions/http-client-2.0.1.dep.yml
generated
32
.licenses/npm/@actions/http-client-2.0.1.dep.yml
generated
@@ -1,32 +0,0 @@
|
|||||||
---
|
|
||||||
name: "@actions/http-client"
|
|
||||||
version: 2.0.1
|
|
||||||
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
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
32
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: "@actions/http-client"
|
||||||
|
version: 2.0.1
|
||||||
|
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: []
|
||||||
2
.licenses/npm/@octokit/core.dep.yml
generated
2
.licenses/npm/@octokit/core.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/core"
|
name: "@octokit/core"
|
||||||
version: 3.5.1
|
version: 3.6.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Extendable client for GitHub's REST & GraphQL APIs
|
summary: Extendable client for GitHub's REST & GraphQL APIs
|
||||||
homepage:
|
homepage:
|
||||||
|
|||||||
34
.licenses/npm/@octokit/plugin-retry.dep.yml
generated
Normal file
34
.licenses/npm/@octokit/plugin-retry.dep.yml
generated
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: "@octokit/plugin-retry"
|
||||||
|
version: 3.0.9
|
||||||
|
type: npm
|
||||||
|
summary: Automatic retry plugin for octokit
|
||||||
|
homepage:
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 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 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: []
|
||||||
8
.licenses/npm/@octokit/request.dep.yml
generated
8
.licenses/npm/@octokit/request.dep.yml
generated
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
name: "@octokit/request"
|
name: "@octokit/request"
|
||||||
version: 5.6.1
|
version: 5.6.3
|
||||||
type: npm
|
type: npm
|
||||||
summary: "Send parameterized requests to GitHubâ\x80\x99s APIs with sensible defaults
|
summary: Send parameterized requests to GitHub's APIs with sensible defaults in browsers
|
||||||
in browsers and Node"
|
and Node
|
||||||
homepage: https://github.com/octokit/request.js#readme
|
homepage:
|
||||||
license: mit
|
license: mit
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: LICENSE
|
||||||
|
|||||||
31
.licenses/npm/bottleneck.dep.yml
generated
Normal file
31
.licenses/npm/bottleneck.dep.yml
generated
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
---
|
||||||
|
name: bottleneck
|
||||||
|
version: 2.19.5
|
||||||
|
type: npm
|
||||||
|
summary: Distributed task scheduler and rate limiter
|
||||||
|
homepage:
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2014 Simon Grondin
|
||||||
|
|
||||||
|
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: []
|
||||||
48
README.md
48
README.md
@@ -7,7 +7,7 @@
|
|||||||
This action makes it easy to quickly write a script in your workflow that
|
This action makes it easy to quickly write a script in your workflow that
|
||||||
uses the GitHub API and the workflow run context.
|
uses the GitHub API and the workflow run context.
|
||||||
|
|
||||||
To use this action, provide an input named `script` that contains the body of an asynchronous function call.
|
To use this action, provide an input named `script` that contains the body of an asynchronous function call.
|
||||||
The following arguments will be provided:
|
The following arguments will be provided:
|
||||||
|
|
||||||
- `github` A pre-authenticated
|
- `github` A pre-authenticated
|
||||||
@@ -83,6 +83,47 @@ output of a github-script step. For some workflows, string encoding is preferred
|
|||||||
script: return "I will be string (not JSON) encoded!"
|
script: return "I will be string (not JSON) encoded!"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Retries
|
||||||
|
|
||||||
|
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@v6
|
||||||
|
id: my-script
|
||||||
|
with:
|
||||||
|
result-encoding: string
|
||||||
|
retries: 3
|
||||||
|
script: |
|
||||||
|
github.rest.issues.get({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
In this example, request failures from `github.rest.issues.get()` will be retried up to 3 times.
|
||||||
|
|
||||||
|
You can also configure which status codes should be exempt from retries via the `retry-exempt-status-codes` option:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/github-script@v6
|
||||||
|
id: my-script
|
||||||
|
with:
|
||||||
|
result-encoding: string
|
||||||
|
retries: 3
|
||||||
|
retry-exempt-status-codes: 400,401
|
||||||
|
script: |
|
||||||
|
github.rest.issues.get({
|
||||||
|
issue_number: context.issue.number,
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
By default, the following status codes will not be retried: `400, 401, 403, 404, 422` [(source)](https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/index.ts#L14).
|
||||||
|
|
||||||
|
These retries are implemented using the [octokit/plugin-retry.js](https://github.com/octokit/plugin-retry.js) plugin. The retries use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) to space out retries. ([source](https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/error-request.ts#L13))
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
Note that `github-token` is optional in this action, and the input is there
|
Note that `github-token` is optional in this action, and the input is there
|
||||||
@@ -354,8 +395,11 @@ jobs:
|
|||||||
To import an ESM file, you'll need to reference your script by an absolute path and ensure you have a `package.json` file with `"type": "module"` specified.
|
To import an ESM file, you'll need to reference your script by an absolute path and ensure you have a `package.json` file with `"type": "module"` specified.
|
||||||
|
|
||||||
For a script in your repository `src/print-stuff.js`:
|
For a script in your repository `src/print-stuff.js`:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
export default function printStuff() { console.log('stuff') }
|
export default function printStuff() {
|
||||||
|
console.log('stuff')
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|||||||
41
__test__/get-retry-options.test.ts
Normal file
41
__test__/get-retry-options.test.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
|
||||||
|
import {getRetryOptions} from '../src/retry-options'
|
||||||
|
|
||||||
|
describe('getRequestOptions', () => {
|
||||||
|
test('retries disabled if retries == 0', async () => {
|
||||||
|
const [retryOptions, requestOptions] = getRetryOptions(0, [400, 500, 502])
|
||||||
|
|
||||||
|
expect(retryOptions.enabled).toBe(false)
|
||||||
|
expect(retryOptions.doNotRetry).toBeFalsy()
|
||||||
|
|
||||||
|
expect(requestOptions.retries).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
test('properties set if retries > 0', async () => {
|
||||||
|
const [retryOptions, requestOptions] = getRetryOptions(1, [400, 500, 502])
|
||||||
|
|
||||||
|
expect(retryOptions.enabled).toBe(true)
|
||||||
|
expect(retryOptions.doNotRetry).toEqual([400, 500, 502])
|
||||||
|
|
||||||
|
expect(requestOptions.retries).toEqual(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('properties set if retries > 0', async () => {
|
||||||
|
const [retryOptions, requestOptions] = getRetryOptions(1, [400, 500, 502])
|
||||||
|
|
||||||
|
expect(retryOptions.enabled).toBe(true)
|
||||||
|
expect(retryOptions.doNotRetry).toEqual([400, 500, 502])
|
||||||
|
|
||||||
|
expect(requestOptions.retries).toEqual(1)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('retryOptions.doNotRetry not set if exemptStatusCodes isEmpty', async () => {
|
||||||
|
const [retryOptions, requestOptions] = getRetryOptions(1, [])
|
||||||
|
|
||||||
|
expect(retryOptions.enabled).toBe(true)
|
||||||
|
expect(retryOptions.doNotRetry).toBeUndefined()
|
||||||
|
|
||||||
|
expect(requestOptions.retries).toEqual(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -21,8 +21,14 @@ inputs:
|
|||||||
previews:
|
previews:
|
||||||
description: A comma-separated list of API previews to accept
|
description: A comma-separated list of API previews to accept
|
||||||
result-encoding:
|
result-encoding:
|
||||||
description: Either "string" or "json" (default "json")—how the result will be encoded
|
description: Either "string" or "json" (default "json")—how the result will be encoded
|
||||||
default: json
|
default: json
|
||||||
|
retries:
|
||||||
|
description: The number of times to retry a request
|
||||||
|
default: "0"
|
||||||
|
retry-exempt-status-codes:
|
||||||
|
description: A comma separated list of status codes that will NOT be retried e.g. "400,500". No effect unless `retries` is set
|
||||||
|
default: 400,401,403,404,422 # from https://github.com/octokit/plugin-retry.js/blob/9a2443746c350b3beedec35cf26e197ea318a261/src/index.ts#L14
|
||||||
outputs:
|
outputs:
|
||||||
result:
|
result:
|
||||||
description: The return value of the script, stringified with `JSON.stringify`
|
description: The return value of the script, stringified with `JSON.stringify`
|
||||||
|
|||||||
4048
dist/index.js
vendored
4048
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
129
package-lock.json
generated
129
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "github-script",
|
"name": "github-script",
|
||||||
"version": "6.2.0",
|
"version": "6.3.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "github-script",
|
"name": "github-script",
|
||||||
"version": "6.2.0",
|
"version": "6.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.9.1",
|
"@actions/core": "^1.9.1",
|
||||||
@@ -16,7 +16,8 @@
|
|||||||
"@actions/io": "^1.1.1",
|
"@actions/io": "^1.1.1",
|
||||||
"@octokit/core": "^3.5.1",
|
"@octokit/core": "^3.5.1",
|
||||||
"@octokit/plugin-paginate-rest": "^2.17.0",
|
"@octokit/plugin-paginate-rest": "^2.17.0",
|
||||||
"@octokit/plugin-rest-endpoint-methods": "^6.3.0"
|
"@octokit/plugin-rest-endpoint-methods": "^6.3.0",
|
||||||
|
"@octokit/plugin-retry": "^3.0.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
@@ -42,14 +43,6 @@
|
|||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/core/node_modules/@actions/http-client": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
|
||||||
"dependencies": {
|
|
||||||
"tunnel": "^0.0.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@actions/exec": {
|
"node_modules/@actions/exec": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.0.tgz",
|
||||||
@@ -59,14 +52,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/github": {
|
"node_modules/@actions/github": {
|
||||||
"version": "5.0.0",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.0.tgz",
|
||||||
"integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==",
|
"integrity": "sha512-tuI80F7JQIhg77ZTTgUAPpVD7ZnP9oHSPN8xw7LOwtA4vEMbAjWJNbmLBfV7xua7r016GyjzWLuec5cs8f/a8A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^2.0.1",
|
||||||
"@octokit/core": "^3.4.0",
|
"@octokit/core": "^3.6.0",
|
||||||
"@octokit/plugin-paginate-rest": "^2.13.3",
|
"@octokit/plugin-paginate-rest": "^2.17.0",
|
||||||
"@octokit/plugin-rest-endpoint-methods": "^5.1.1"
|
"@octokit/plugin-rest-endpoint-methods": "^5.13.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods": {
|
"node_modules/@actions/github/node_modules/@octokit/plugin-rest-endpoint-methods": {
|
||||||
@@ -91,11 +84,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/http-client": {
|
"node_modules/@actions/http-client": {
|
||||||
"version": "1.0.11",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||||
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tunnel": "0.0.6"
|
"tunnel": "^0.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/io": {
|
"node_modules/@actions/io": {
|
||||||
@@ -1081,13 +1074,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/core": {
|
"node_modules/@octokit/core": {
|
||||||
"version": "3.5.1",
|
"version": "3.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz",
|
||||||
"integrity": "sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw==",
|
"integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/auth-token": "^2.4.4",
|
"@octokit/auth-token": "^2.4.4",
|
||||||
"@octokit/graphql": "^4.5.8",
|
"@octokit/graphql": "^4.5.8",
|
||||||
"@octokit/request": "^5.6.0",
|
"@octokit/request": "^5.6.3",
|
||||||
"@octokit/request-error": "^2.0.5",
|
"@octokit/request-error": "^2.0.5",
|
||||||
"@octokit/types": "^6.0.3",
|
"@octokit/types": "^6.0.3",
|
||||||
"before-after-hook": "^2.2.0",
|
"before-after-hook": "^2.2.0",
|
||||||
@@ -1158,16 +1151,25 @@
|
|||||||
"@octokit/openapi-types": "^13.1.0"
|
"@octokit/openapi-types": "^13.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@octokit/plugin-retry": {
|
||||||
|
"version": "3.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz",
|
||||||
|
"integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@octokit/types": "^6.0.3",
|
||||||
|
"bottleneck": "^2.15.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@octokit/request": {
|
"node_modules/@octokit/request": {
|
||||||
"version": "5.6.1",
|
"version": "5.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz",
|
||||||
"integrity": "sha512-Ls2cfs1OfXaOKzkcxnqw5MR6drMA/zWX/LIS/p8Yjdz7QKTPQLMsB3R+OvoxE6XnXeXEE2X7xe4G4l4X0gRiKQ==",
|
"integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/endpoint": "^6.0.1",
|
"@octokit/endpoint": "^6.0.1",
|
||||||
"@octokit/request-error": "^2.1.0",
|
"@octokit/request-error": "^2.1.0",
|
||||||
"@octokit/types": "^6.16.1",
|
"@octokit/types": "^6.16.1",
|
||||||
"is-plain-object": "^5.0.0",
|
"is-plain-object": "^5.0.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.7",
|
||||||
"universal-user-agent": "^6.0.0"
|
"universal-user-agent": "^6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1803,6 +1805,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
|
||||||
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
|
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/bottleneck": {
|
||||||
|
"version": "2.19.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
||||||
|
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
||||||
|
},
|
||||||
"node_modules/brace-expansion": {
|
"node_modules/brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
@@ -6224,16 +6231,6 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"uuid": "^8.3.2"
|
"uuid": "^8.3.2"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@actions/http-client": {
|
|
||||||
"version": "2.0.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
|
||||||
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
|
||||||
"requires": {
|
|
||||||
"tunnel": "^0.0.6"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
@@ -6245,14 +6242,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/github": {
|
"@actions/github": {
|
||||||
"version": "5.0.0",
|
"version": "5.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.0.tgz",
|
||||||
"integrity": "sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ==",
|
"integrity": "sha512-tuI80F7JQIhg77ZTTgUAPpVD7ZnP9oHSPN8xw7LOwtA4vEMbAjWJNbmLBfV7xua7r016GyjzWLuec5cs8f/a8A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@actions/http-client": "^1.0.11",
|
"@actions/http-client": "^2.0.1",
|
||||||
"@octokit/core": "^3.4.0",
|
"@octokit/core": "^3.6.0",
|
||||||
"@octokit/plugin-paginate-rest": "^2.13.3",
|
"@octokit/plugin-paginate-rest": "^2.17.0",
|
||||||
"@octokit/plugin-rest-endpoint-methods": "^5.1.1"
|
"@octokit/plugin-rest-endpoint-methods": "^5.13.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/plugin-rest-endpoint-methods": {
|
"@octokit/plugin-rest-endpoint-methods": {
|
||||||
@@ -6276,11 +6273,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/http-client": {
|
"@actions/http-client": {
|
||||||
"version": "1.0.11",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
|
||||||
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
|
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tunnel": "0.0.6"
|
"tunnel": "^0.0.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@actions/io": {
|
"@actions/io": {
|
||||||
@@ -7046,13 +7043,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/core": {
|
"@octokit/core": {
|
||||||
"version": "3.5.1",
|
"version": "3.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz",
|
||||||
"integrity": "sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw==",
|
"integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/auth-token": "^2.4.4",
|
"@octokit/auth-token": "^2.4.4",
|
||||||
"@octokit/graphql": "^4.5.8",
|
"@octokit/graphql": "^4.5.8",
|
||||||
"@octokit/request": "^5.6.0",
|
"@octokit/request": "^5.6.3",
|
||||||
"@octokit/request-error": "^2.0.5",
|
"@octokit/request-error": "^2.0.5",
|
||||||
"@octokit/types": "^6.0.3",
|
"@octokit/types": "^6.0.3",
|
||||||
"before-after-hook": "^2.2.0",
|
"before-after-hook": "^2.2.0",
|
||||||
@@ -7116,16 +7113,25 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@octokit/plugin-retry": {
|
||||||
|
"version": "3.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-3.0.9.tgz",
|
||||||
|
"integrity": "sha512-r+fArdP5+TG6l1Rv/C9hVoty6tldw6cE2pRHNGmFPdyfrc696R6JjrQ3d7HdVqGwuzfyrcaLAKD7K8TX8aehUQ==",
|
||||||
|
"requires": {
|
||||||
|
"@octokit/types": "^6.0.3",
|
||||||
|
"bottleneck": "^2.15.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@octokit/request": {
|
"@octokit/request": {
|
||||||
"version": "5.6.1",
|
"version": "5.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz",
|
||||||
"integrity": "sha512-Ls2cfs1OfXaOKzkcxnqw5MR6drMA/zWX/LIS/p8Yjdz7QKTPQLMsB3R+OvoxE6XnXeXEE2X7xe4G4l4X0gRiKQ==",
|
"integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/endpoint": "^6.0.1",
|
"@octokit/endpoint": "^6.0.1",
|
||||||
"@octokit/request-error": "^2.1.0",
|
"@octokit/request-error": "^2.1.0",
|
||||||
"@octokit/types": "^6.16.1",
|
"@octokit/types": "^6.16.1",
|
||||||
"is-plain-object": "^5.0.0",
|
"is-plain-object": "^5.0.0",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.7",
|
||||||
"universal-user-agent": "^6.0.0"
|
"universal-user-agent": "^6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -7613,6 +7619,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz",
|
||||||
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
|
"integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ=="
|
||||||
},
|
},
|
||||||
|
"bottleneck": {
|
||||||
|
"version": "2.19.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
|
||||||
|
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw=="
|
||||||
|
},
|
||||||
"brace-expansion": {
|
"brace-expansion": {
|
||||||
"version": "1.1.11",
|
"version": "1.1.11",
|
||||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "github-script",
|
"name": "github-script",
|
||||||
"description": "A GitHub action for executing a simple script",
|
"description": "A GitHub action for executing a simple script",
|
||||||
"version": "6.2.0",
|
"version": "6.3.0",
|
||||||
"author": "GitHub",
|
"author": "GitHub",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
@@ -38,7 +38,8 @@
|
|||||||
"@actions/io": "^1.1.1",
|
"@actions/io": "^1.1.1",
|
||||||
"@octokit/core": "^3.5.1",
|
"@octokit/core": "^3.5.1",
|
||||||
"@octokit/plugin-paginate-rest": "^2.17.0",
|
"@octokit/plugin-paginate-rest": "^2.17.0",
|
||||||
"@octokit/plugin-rest-endpoint-methods": "^6.3.0"
|
"@octokit/plugin-rest-endpoint-methods": "^6.3.0",
|
||||||
|
"@octokit/plugin-retry": "^3.0.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^27.0.2",
|
||||||
|
|||||||
18
src/main.ts
18
src/main.ts
@@ -3,7 +3,14 @@ import * as exec from '@actions/exec'
|
|||||||
import {context, getOctokit} from '@actions/github'
|
import {context, getOctokit} from '@actions/github'
|
||||||
import * as glob from '@actions/glob'
|
import * as glob from '@actions/glob'
|
||||||
import * as io from '@actions/io'
|
import * as io from '@actions/io'
|
||||||
|
import {retry} from '@octokit/plugin-retry'
|
||||||
import {callAsyncFunction} from './async-function'
|
import {callAsyncFunction} from './async-function'
|
||||||
|
import {
|
||||||
|
getRetryOptions,
|
||||||
|
parseNumberArray,
|
||||||
|
RequestOptions,
|
||||||
|
RetryOptions
|
||||||
|
} from './retry-options'
|
||||||
import {wrapRequire} from './wrap-require'
|
import {wrapRequire} from './wrap-require'
|
||||||
|
|
||||||
process.on('unhandledRejection', handleError)
|
process.on('unhandledRejection', handleError)
|
||||||
@@ -13,6 +20,8 @@ type Options = {
|
|||||||
log?: Console
|
log?: Console
|
||||||
userAgent?: string
|
userAgent?: string
|
||||||
previews?: string[]
|
previews?: string[]
|
||||||
|
retry?: RetryOptions
|
||||||
|
request?: RequestOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
async function main(): Promise<void> {
|
async function main(): Promise<void> {
|
||||||
@@ -20,13 +29,20 @@ async function main(): Promise<void> {
|
|||||||
const debug = core.getInput('debug')
|
const debug = core.getInput('debug')
|
||||||
const userAgent = core.getInput('user-agent')
|
const userAgent = core.getInput('user-agent')
|
||||||
const previews = core.getInput('previews')
|
const previews = core.getInput('previews')
|
||||||
|
const retries = parseInt(core.getInput('retries'))
|
||||||
|
const exemptStatusCodes = parseNumberArray(
|
||||||
|
core.getInput('retry-exempt-status-codes')
|
||||||
|
)
|
||||||
|
const [retryOpts, requestOpts] = getRetryOptions(retries, exemptStatusCodes)
|
||||||
|
|
||||||
const opts: Options = {}
|
const opts: Options = {}
|
||||||
if (debug === 'true') opts.log = console
|
if (debug === 'true') opts.log = console
|
||||||
if (userAgent != null) opts.userAgent = userAgent
|
if (userAgent != null) opts.userAgent = userAgent
|
||||||
if (previews != null) opts.previews = previews.split(',')
|
if (previews != null) opts.previews = previews.split(',')
|
||||||
|
if (retryOpts) opts.retry = retryOpts
|
||||||
|
if (requestOpts) opts.request = requestOpts
|
||||||
|
|
||||||
const github = getOctokit(token, opts)
|
const github = getOctokit(token, opts, retry)
|
||||||
const script = core.getInput('script', {required: true})
|
const script = core.getInput('script', {required: true})
|
||||||
|
|
||||||
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
// Using property/value shorthand on `require` (e.g. `{require}`) causes compilation errors.
|
||||||
|
|||||||
50
src/retry-options.ts
Normal file
50
src/retry-options.ts
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import * as core from '@actions/core'
|
||||||
|
|
||||||
|
export type RetryOptions = {
|
||||||
|
doNotRetry?: number[]
|
||||||
|
enabled?: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export type RequestOptions = {
|
||||||
|
retries?: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getRetryOptions(
|
||||||
|
retries: number,
|
||||||
|
exemptStatusCodes: number[]
|
||||||
|
): [RetryOptions, RequestOptions] {
|
||||||
|
if (retries <= 0) {
|
||||||
|
return [{enabled: false}, {}]
|
||||||
|
}
|
||||||
|
|
||||||
|
const retryOptions: RetryOptions = {
|
||||||
|
enabled: true
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exemptStatusCodes.length > 0) {
|
||||||
|
retryOptions.doNotRetry = exemptStatusCodes
|
||||||
|
}
|
||||||
|
|
||||||
|
const requestOptions: RequestOptions = {
|
||||||
|
retries
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(
|
||||||
|
`GitHub client configured with: (retries: ${
|
||||||
|
requestOptions.retries
|
||||||
|
}, retry-exempt-status-code: ${
|
||||||
|
retryOptions?.doNotRetry ?? 'octokit default: [400, 401, 403, 404, 422]'
|
||||||
|
})`
|
||||||
|
)
|
||||||
|
|
||||||
|
return [retryOptions, requestOptions]
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseNumberArray(listString: string): number[] {
|
||||||
|
if (!listString) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
const split = listString.trim().split(',')
|
||||||
|
return split.map(x => parseInt(x))
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user