Skip to content

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 dscho force-pushed the add-ghes-support branch from 97bc020 to 98d6a95 Compare January 9, 2023 14:22
@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.

@dscho dscho force-pushed the add-ghes-support branch from 98d6a95 to 25d3084 Compare January 9, 2023 16:05
@dscho dscho force-pushed the add-ghes-support branch from 25d3084 to c8bea55 Compare January 9, 2023 16:10
@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.

3 participants