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 using action with Github Enterprise server #148

Merged
merged 2 commits into from
Jan 9, 2023

Conversation

steve21168
Copy link
Contributor

This allows this action to work with GHES instance whose api url is not the public github.com domain.

Copy link
Collaborator

@dscho dscho left a 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
Copy link
Collaborator

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.

Copy link
Owner

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)

Copy link
Collaborator

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.

Copy link
Owner

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)

Copy link
Collaborator

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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 }}

Copy link
Contributor Author

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.

@dscho
Copy link
Collaborator

dscho commented Jan 9, 2023

@mxschmitt I rebased and force-pushed this PR branch on top of #150 to avoid merge conflicts.

steve21168 and others added 2 commits January 9, 2023 17:09
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@mxschmitt mxschmitt merged commit 1005f9c into mxschmitt:master Jan 9, 2023
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