tdg-github-action
tdg-github-action copied to clipboard
[Feature] Support GHE
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.
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.
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.
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
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.