Skip to content

fix: remove custom proxy handling #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
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
Use native fetch
  • Loading branch information
parkerbxyz committed Sep 7, 2024
commit ff0675ea9684724384f9aee492021c93a1d796d0
5 changes: 2 additions & 3 deletions lib/request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import core from "@actions/core";
import { request } from "@octokit/request";
import { EnvHttpProxyAgent, fetch as undiciFetch } from "undici";
import { EnvHttpProxyAgent } from "undici";

const baseUrl = core.getInput("github-api-url").replace(/\/$/, "");

@@ -12,7 +12,6 @@ export default request.defaults({
},
baseUrl,
request: {
fetch: undiciFetch,
dispatcher: envHttpProxyAgent
dispatcher: envHttpProxyAgent,
Copy link
Contributor

@gr2m gr2m Sep 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will do anything. There is. no dispatch option in options.request, see all implemented options in https://github.com/octokit/request.js#request

What we have to do is to implement a fetch wrapper

function fetchWithProxyAgent(url, options) {
  return fetch(url, { ... options, dispatcher: envHttpProxyAgent })
}

And then use pass that custom fetch implementation as options.request.fetch

Suggested change
dispatcher: envHttpProxyAgent,
fetch: fetchWithProxyAgent,

},
});
Loading
Oops, something went wrong.