-
Notifications
You must be signed in to change notification settings - Fork 5
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
Moctokit is not working with Act runEvent #72
Comments
From the
If the client you are using does not honor these env variables, then the only way to actually make this work would be to make the client use a proxy forcefully. For octokit you can do something like this: The only way I could think of bypassing this problem of CONNECT request was to setup a MITM server and somehow configure all the containers created by |
@shubhbapna |
@david-all-win-software Actually you might be able to use it without extra modification in example you mentioned.
In the
It looks like we can control the base url of the proxy using the So in your test file all you need to do is initialize moctokit to use http instead of https and set the env before executing const moctokit = new Moctokit("http://api.github.com");
const result = await act.setEnv("GITHUB_API_URL", "http://api.github.com").runEvent("workflow_dispatch", {mockApi: [...]}) Hopefully this works. I haven't gotten the chance to try it out but let me know if it works. I would like to document it |
@shubhbapna Thanks, very good suggestion, I just tried it, but it's generating a 500 error status. It seems that it's not respecting the HTTP protocol we are setting.
|
I believe you're not initialising the moctokit properly. You are not passing the const moctokit = new Moctokit("http://api.github.com"); I had a similar issue and this helped solve it. |
Hmm I finally was able to try this out using the
I will investigate and see if I can fix it in act-js |
Just to update y'all, I think the issue over here is the proxy configuration in |
Hi @david-all-win-software sorry for the delay, after talking to various people it seems like the proxy configuration in @actions/github is valid but unnecessary so I am not entirely sure they will accept my PR. In the mean time I was able to figure out how to get this to work in my library itself. See the following PR for detailed explanation - kiegroup/act-js#50 I have released the new version of |
Describe the bug
There is an issue when trying to set up a GitHub API mock using Moctokit to generate the mock and send it when running an event with act-js.
To Reproduce
Expected behavior
The response from running the workflow should contain the mocked information.
The text was updated successfully, but these errors were encountered: