Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f34078a

Browse files
committed
Make node-fetch available
1 parent 311d596 commit f34078a

File tree

5 files changed

+35
-6
lines changed

5 files changed

+35
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ The following arguments will be provided:
1818
- `glob` A reference to the [@actions/glob](https://github.com/actions/toolkit/tree/main/packages/glob) package
1919
- `io` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/main/packages/io) package
2020
- `exec` A reference to the [@actions/exec](https://github.com/actions/toolkit/tree/main/packages/exec) package
21+
- `fetch` A reference to the [node-fetch](https://github.com/node-fetch/node-fetch) package
2122
- `require` A proxy wrapper around the normal Node.js `require` to enable
2223
requiring relative paths (relative to the current working directory) and
2324
requiring npm packages installed in the current working directory. If for

package-lock.json

Lines changed: 26 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@
3939
"@octokit/core": "^3.5.1",
4040
"@octokit/plugin-paginate-rest": "^2.17.0",
4141
"@octokit/plugin-rest-endpoint-methods": "^6.3.0",
42-
"@octokit/plugin-retry": "^3.0.9"
42+
"@octokit/plugin-retry": "^3.0.9",
43+
"node-fetch": "^2.6.7"
4344
},
4445
"devDependencies": {
4546
"@types/jest": "^27.0.2",
47+
"@types/node-fetch": "^2.6.2",
4648
"@typescript-eslint/eslint-plugin": "^3.10.1",
4749
"@typescript-eslint/parser": "^3.10.1",
4850
"@vercel/ncc": "^0.36.0",

src/async-function.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {Context} from '@actions/github/lib/context'
44
import {GitHub} from '@actions/github/lib/utils'
55
import * as glob from '@actions/glob'
66
import * as io from '@actions/io'
7+
import fetch from 'node-fetch'
78

89
const AsyncFunction = Object.getPrototypeOf(async () => null).constructor
910

@@ -14,6 +15,7 @@ type AsyncFunctionArguments = {
1415
exec: typeof exec
1516
glob: typeof glob
1617
io: typeof io
18+
fetch: typeof fetch
1719
require: NodeRequire
1820
__original_require__: NodeRequire
1921
}

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {RequestRequestOptions} from '@octokit/types'
99
import {callAsyncFunction} from './async-function'
1010
import {getRetryOptions, parseNumberArray, RetryOptions} from './retry-options'
1111
import {wrapRequire} from './wrap-require'
12+
import fetch from 'node-fetch'
1213

1314
process.on('unhandledRejection', handleError)
1415
main().catch(handleError)
@@ -56,7 +57,8 @@ async function main(): Promise<void> {
5657
core,
5758
exec,
5859
glob,
59-
io
60+
io,
61+
fetch
6062
},
6163
script
6264
)

0 commit comments

Comments
 (0)