Skip to content
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

Add support for creating PR's in ghes and behind proxy #40

Closed

Conversation

sethumadhav07
Copy link

This PR addresses the issue #39

Copy link
Owner

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

Left some comments inline.

options.baseUrl = `${baseurl}/api/v3`;
}

const proxy = process.env.https_proxy || process.env.HTTPS_PROXY;
Copy link
Owner

Choose a reason for hiding this comment

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

Is this some kind of standardized env variable? I think I'd prefer this to be a input because it is easier to test.

Copy link
Author

Choose a reason for hiding this comment

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

yes it is standardized env variable. i have seen various other github actions doing very similar.

Copy link
Owner

Choose a reason for hiding this comment

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

Okay, can we document this in the README then please?

Copy link
Author

Choose a reason for hiding this comment

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

sure will do.

src/getInputs.ts Outdated Show resolved Hide resolved
@thomaseizinger
Copy link
Owner

Hmm, I never tried running these CI scripts from a fork, only from my own branches.

What is your appetite for trying fix this? I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request.

It is fine if you don't want to but I also can't promise that I'll find time very soon to try and play around with it.

@sethumadhav07
Copy link
Author

can you approve the above PR and see if that fixes it?

Not sure what you mean by - "I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request."?

i am actually pushing to my fork only.

@thomaseizinger
Copy link
Owner

can you approve the above PR and see if that fixes it?

Not sure what you mean by - "I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request."?

i am actually pushing to my fork only.

Sorry, I should have been more clear.
The CI scripts actually use the action to open pull requests: https://github.com/thomaseizinger/create-pull-request/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Aclosed+author%3Aapp%2Fgithub-actions, effectively integration testing the code before it is being merged. That only worked though because I was developing in branches (and not forks) and hence the token provided in GITHUB_TOKEN had enough permissions to push to a branch.

You are the first one to contribute which shows that my CI scripts don't work with forks 😅

What I meant with "I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request" is that the CI scripts could be modified to try and push to a remote that is under the username of whoever triggered the workflow. There is a git_url field inside the pull_request event payload https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request that we would need to use.
Once a remote branch is pushed, the create-pull-request action can be run again.

However, maybe this kind of integration testing is also overkill though and should just be removed :)

@sethumadhav07
Copy link
Author

can you approve the above PR and see if that fixes it?
Not sure what you mean by - "I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request."?
i am actually pushing to my fork only.

Sorry, I should have been more clear.
The CI scripts actually use the action to open pull requests: https://github.com/thomaseizinger/create-pull-request/pulls?q=is%3Apr+sort%3Aupdated-desc+is%3Aclosed+author%3Aapp%2Fgithub-actions, effectively integration testing the code before it is being merged. That only worked though because I was developing in branches (and not forks) and hence the token provided in GITHUB_TOKEN had enough permissions to push to a branch.

You are the first one to contribute which shows that my CI scripts don't work with forks 😅

What I meant with "I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request" is that the CI scripts could be modified to try and push to a remote that is under the username of whoever triggered the workflow. There is a git_url field inside the pull_request event payload https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request that we would need to use.
Once a remote branch is pushed, the create-pull-request action can be run again.

However, maybe this kind of integration testing is also overkill though and should just be removed :)

Unfortunately, I don't currently have time for this. i just want this PR to be merged so that we can use this github action.
If you want me to remove the three tests that are failing, i can quickly remove it. Otherwise we can run tests only when the PRs are not from fork until someone gets time to address it?

@thomaseizinger
Copy link
Owner

can you approve the above PR and see if that fixes it?
Not sure what you mean by - "I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request."?
i am actually pushing to my fork only.

Sorry, I should have been more clear.
The CI scripts actually use the action to open pull requests: thomaseizinger/create-pull-request/pulls (sort:updated-desc is:closed author:app/github-actions), effectively integration testing the code before it is being merged. That only worked though because I was developing in branches (and not forks) and hence the token provided in GITHUB_TOKEN had enough permissions to push to a branch.
You are the first one to contribute which shows that my CI scripts don't work with forks sweat_smile
What I meant with "I think it should be doable by adding the fork that exists under your username and explicitly pushing to that so we can open a pull-request" is that the CI scripts could be modified to try and push to a remote that is under the username of whoever triggered the workflow. There is a git_url field inside the pull_request event payload docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#pull_request that we would need to use.
Once a remote branch is pushed, the create-pull-request action can be run again.
However, maybe this kind of integration testing is also overkill though and should just be removed :)

Unfortunately, I don't currently have time for this. i just want this PR to be merged so that we can use this github action.
If you want me to remove the three tests that are failing, i can quickly remove it. Otherwise we can run tests only when the PRs are not from fork until someone gets time to address it?

I will take your commits and push them to a branch on the repo. That should be good enough for now. Thanks for the contribution!

@thomaseizinger
Copy link
Owner

Closed in favor of #41.

@sethumadhav07 sethumadhav07 deleted the supportghes branch June 16, 2021 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants