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

[Feature] Support GHE #51

Open
asciifaceman opened this issue Nov 18, 2023 · 4 comments
Open

[Feature] Support GHE #51

asciifaceman opened this issue Nov 18, 2023 · 4 comments

Comments

@asciifaceman
Copy link

Currently this action doesn't support Github Enterprise / on-prem installs.

Is there any plan or desire to support GHE?

I was digging through the github-go API and it does seem to support it with a

NewClient().WithEnterpriseURLs(...)

https://pkg.go.dev/github.com/google/go-github/v56/github#Client.WithEnterpriseURLs

However I'm not familiar enough with the library to know if this would do what is needed.

@ribtoks
Copy link
Owner

ribtoks commented Nov 18, 2023

There's no plan, but I'm absolutely open for any contributions to add GHE support. This would be absolutely in line with this project's goals.

@asciifaceman
Copy link
Author

I'll be honest and say I don't know if I have the capacity myself. I know Go but would have to familiarize myself with the github lib and your own style to see how it would fit in - as well I could only test it in the context of my company's GHE (the capacity issue).

For the sake of contributing to discussion around this feature some of my disorganized thoughts:

Potentially 3 new vars

  • enterprise_base_url: string
  • enterprise_upload_url: string
  • enterprise_remote: bool (false default)

enterprise_remote would denote that the action should use a WithEnterpriseURLs functional client build step with the two other vars passed in.

I haven't explored the lib to know if actual interaction with the remote changes in this circumstance, There seems to be a significant amount of enterprise-specific code in the upstream lib but I didn't look close enough to see if this is backend stuff it takes care of or API a developer must use. I simply don't know if it would use the same library SDK to interact with enterprise issues as it does public github ones.

@asciifaceman
Copy link
Author

asciifaceman commented Nov 19, 2023

WithEnterpriseURLs returns a copy of the client configured to use the provided base and upload URLs. If the base URL does not have the suffix "/api/v3/", it will be added automatically. If the upload URL does not have the suffix "/api/uploads", it will be added automatically.

Note that WithEnterpriseURLs is a convenience helper only; its behavior is equivalent to setting the BaseURL and UploadURL fields.

Another important thing is that by default, the GitHub Enterprise URL format should be http(s)://[hostname]/api/v3/ or you will always receive the 406 status code. The upload URL format should be http(s)://[hostname]/api/uploads

This makes it seem like it wouldn't be too inconvenient, but would need to look more closely

@ribtoks
Copy link
Owner

ribtoks commented Nov 19, 2023

Yes, seems that the code change would be to provide the BaseURL via environment variables and in code if it's not empty, set it to the client. Also would need to add the parameters in action.yml file (and update README.md), but it does not seem to be a major code change, should be pretty straightforward.

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

No branches or pull requests

2 participants