Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make node-fetch available
  • Loading branch information
danmichaelo committed Jan 6, 2023
commit f34078a491d07f84bf9d77a00b191c6752f4cc68
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following arguments will be provided:
- `glob` A reference to the [@actions/glob](https://github.com/actions/toolkit/tree/main/packages/glob) package
- `io` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/main/packages/io) package
- `exec` A reference to the [@actions/exec](https://github.com/actions/toolkit/tree/main/packages/exec) package
- `fetch` A reference to the [node-fetch](https://github.com/node-fetch/node-fetch) package
- `require` A proxy wrapper around the normal Node.js `require` to enable
requiring relative paths (relative to the current working directory) and
requiring npm packages installed in the current working directory. If for
Expand Down
30 changes: 26 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
"@octokit/core": "^3.5.1",
"@octokit/plugin-paginate-rest": "^2.17.0",
"@octokit/plugin-rest-endpoint-methods": "^6.3.0",
"@octokit/plugin-retry": "^3.0.9"
"@octokit/plugin-retry": "^3.0.9",
"node-fetch": "^2.6.7"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/node-fetch": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"@vercel/ncc": "^0.36.0",
Expand Down
2 changes: 2 additions & 0 deletions src/async-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Context} from '@actions/github/lib/context'
import {GitHub} from '@actions/github/lib/utils'
import * as glob from '@actions/glob'
import * as io from '@actions/io'
import fetch from 'node-fetch'

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

Expand All @@ -14,6 +15,7 @@ type AsyncFunctionArguments = {
exec: typeof exec
glob: typeof glob
io: typeof io
fetch: typeof fetch
require: NodeRequire
__original_require__: NodeRequire
}
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {RequestRequestOptions} from '@octokit/types'
import {callAsyncFunction} from './async-function'
import {getRetryOptions, parseNumberArray, RetryOptions} from './retry-options'
import {wrapRequire} from './wrap-require'
import fetch from 'node-fetch'

process.on('unhandledRejection', handleError)
main().catch(handleError)
Expand Down Expand Up @@ -56,7 +57,8 @@ async function main(): Promise<void> {
core,
exec,
glob,
io
io,
fetch
},
script
)
Expand Down