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

Support for self-hosted enterprise github #165

Open
david1155 opened this issue Mar 22, 2024 · 3 comments
Open

Support for self-hosted enterprise github #165

david1155 opened this issue Mar 22, 2024 · 3 comments

Comments

@david1155
Copy link

Hi,

It may be good to add support for GitHub Enterprise:

+ github-assets-uploader -logtostderr -f ../zi-tfc-env0-v0.1.0-linux-arm64.tar.gz -mediatype application/gzip -repo Terraform/env0-migration-go -token *** -tag=v0.1.0 -releasename= -retry 3
W0322 20:18:09.198415    1513 main.go:48] Upload asset error, will retry in 11s: GET https://api.github.com/repos/Enterprise/company-repo/releases/tags/v0.1.0: 401 Bad credentials []
@wangyoucao577
Copy link
Owner

The upload tool has supported it already, see
https://github.com/wangyoucao577/assets-uploader/blob/a3e2d69c04c739d533cac3f583f564860622a2cd/cmd/github-assets-uploader/main.go#L68

You may need to set a baseurl flag for it, which hasn't been exposed on the action. I'm not able to test with Github Enterprise, so would you please fork the action to have a try? Add your baseurl

github-assets-uploader -logtostderr -f ${RELEASE_ASSET_PATH}${MD5_EXT} -mediatype ${MD5_MEDIA_TYPE} ${GITHUB_ASSETS_UPLOADR_EXTRA_OPTIONS} -repo ${RELEASE_REPO} -token ${INPUT_GITHUB_TOKEN} -tag=${RELEASE_TAG} -releasename=${RELEASE_NAME} -retry ${INPUT_RETRY}
here.

PR is welcome if it works. We may need to add an extra enterprise_url option for this, or maybe there'll be the URL env during action runnning? In such case, we could fetch it from env and no need for option anymore.

@bigjew92
Copy link

bigjew92 commented Mar 28, 2024

Looking for this as well. Looks like GITHUB_API_URL and GITHUB_SERVER_URL get exposed to the job, so might not need to add an extra option. Checked here: https://docs.github.com/en/actions/learn-github-actions/variables and also on the output from one of our runners jobs where this was failing.

GITHUB_SERVER_URL=https://git.mycompany.com/
GITHUB_API_URL=https://git.mycompany.com/api/v3

Tested with an internal repository to my enterprise instance. Adding -baseUrl ${GITHUB_SERVER_URL} was the only change I needed to make. bigjew92@18fcd46

@wangyoucao577
Copy link
Owner

Looking for this as well. Looks like GITHUB_API_URL and GITHUB_SERVER_URL get exposed to the job, so might not need to add an extra option. Checked here: https://docs.github.com/en/actions/learn-github-actions/variables and also on the output from one of our runners jobs where this was failing.

GITHUB_SERVER_URL=https://git.mycompany.com/ GITHUB_API_URL=https://git.mycompany.com/api/v3

Tested with an internal repository to my enterprise instance. Adding -baseUrl ${GITHUB_SERVER_URL} was the only change I needed to make. bigjew92@18fcd46

Nice work! So set -baseUrl ${GITHUB_SERVER_URL} if ${GITHUB_SERVER_URL} != https://github.com may good enough.

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

3 participants