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

[FEAT]: Support overriding github api url #77

Open
1 task done
gr2m opened this issue Nov 6, 2023 · 6 comments · May be fixed by #88
Open
1 task done

[FEAT]: Support overriding github api url #77

gr2m opened this issue Nov 6, 2023 · 6 comments · May be fixed by #88
Assignees

Comments

@gr2m
Copy link
Contributor

gr2m commented Nov 6, 2023

originally posted by @harshtrivedi134 at octokit/octokit.js#2569

Describe the need

Reference from discussion
I was creating an access token for a github app installed in a different organization and repository. I learned about https://github.com/actions/create-github-app-token#create-a-token-for-all-repositories-in-another-owners-installation.

Similar to the baseUrl option in Octokit constructor, it would be great if we could specify the github API url as an input to this action

      - uses: actions/create-github-app-token@v1
        id: get-access-token
        with:
          app-id: APP_ID
          private-key: PRIVATE_KEY
          base-url: https://slack-github.com/api/

I tried creating an access token for my github app installed in a different organization by specifying the owner and repository using the following:

      - uses: actions/create-github-app-token@v1
        id: get-access-token
        with:
          app-id: APP_ID
          private-key: PRIVATE_KEY
          owner: "owner"
          repositories: |
            owner/repo_name

However, the default github API hostname/url is set to api.github.com and we cannot change it to a custom hosted github installation.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@gr2m
Copy link
Contributor Author

gr2m commented Nov 6, 2023

We pretty much implement the same thing as tibdex/github-app-token does here: https://github.com/tibdex/github-app-token/blob/3eb77c7243b85c65e84acfa93fdbac02fb6bd532/action.yml#L8C1-L10C35

@smockle
Copy link
Contributor

smockle commented Nov 6, 2023

@gr2m Isn’t this already supported? The action reads an environment variable named GITHUB_API_URL: https://github.com/actions/create-github-app-token/blob/9769eb4076a1785cd28c7f83b17b1e855fb092b8/lib/request.js#L4C30-L4C30

@gr2m
Copy link
Contributor Author

gr2m commented Nov 6, 2023

I think @harshtrivedi134 is asking to pass a custom GitHub API URL which is different from the one configured in the Action, in order to access an organization on a different server?

@harshtrivedi134
Copy link

harshtrivedi134 commented Nov 6, 2023

I think @harshtrivedi134 is asking to pass a custom GitHub API URL which is different from the one configured in the Action, in order to access an organization on a different server?

That's correct. In my case, I am trying to run the workflow in a github.com repo and the Github app is installed in an organization in Github Enterprise.

@cliffchapmanrbx
Copy link

This is a hard blocker from our team using this action. A long time ago I filed a ticket for this in tibdex's version of the action. Support is nearly trivial to add and this would allow us to migrate our use to this action.

@gr2m
Copy link
Contributor Author

gr2m commented Dec 16, 2023

I started a PR here, can y'all have a look? #88. Tests still need fixing and I'll add a test specific to the new option, but otherwise this should be good to go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants