-
-
Notifications
You must be signed in to change notification settings - Fork 306
Add support for using action with Github Enterprise server #148
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@steve21168 thank you for your contribution!
src/index.js
Outdated
|
||
const octokit = new Octokit({ | ||
baseUrl: apiUrl, | ||
auth: process.env.GITHUB_TOKEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great! This also addresses the infrequent problem I encountered recently where rate limiting of GitHub hosted build agents kicked in due to other workflows issuing unauthenticated API requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I think by default GitHub Actions does not pass the GITHUB_TOKEN into the GitHub Action - the user would have to manually pass it over)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I think by default GitHub Actions does not pass the GITHUB_TOKEN into the GitHub Action - the user would have to manually pass it over)
I think you are right. But we can use this trick instead of requiring the user to manually specify it.
I'll whip up a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool we should also wire it up with brew I think: #69 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool we should also wire it up with brew I think: #69 (comment)
Good point. I opened #150 and will augment it accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I tested this on my teams GHES and the token was available via the process.env
call . I had originally implemented this via passing the token and then realized it could be simpler.
According to the docs github context has the token:
https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
So at the least I think you could do this:
...
with:
github-token: ${{ github.token }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay I see we added:
default: ${{ github.token }}
Nice! That's even better. It's great when the user doesn't even have to be aware of the difference in where they're running the action.
97bc020
to
98d6a95
Compare
@mxschmitt I rebased and force-pushed this PR branch on top of #150 to avoid merge conflicts. |
98d6a95
to
25d3084
Compare
Signed-off-by: Johannes Schindelin <[email protected]>
25d3084
to
c8bea55
Compare
This allows this action to work with GHES instance whose api url is not the public github.com domain.