actions / actions/toolkit

Allow customizing the `GITHUB_SERVER_URL` for GHE instances

Open
#1,530 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the enhancement

Currently, we have the Github URL hardcoded to :

  const treeUrl = `https://api.github.com/repos/${owner}/${repo}/git/trees/${branch}`

https://github.com/actions/toolkit/blob/main/packages/tool-cache/src/tool-cache.ts#L596C9-L596C16

While that's fine for github.com users, that tends to cause rate limiting issues for GHE users such as

API rate limit exceeded for xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

This is seen in action for setup-go for example as a call such as :

const releases = await tc.getManifestFromRepo(
  'actions',
  'go-versions',
  auth,
  'main'
);

Builds a call to https://api.github.com/repos/actions/go-versions/git/trees/main triggering the rate limits error explained above

Additional information

Can we leverage process.env['GITHUB_SERVER_URL' ?

Example :

https://github.com/actions/checkout/blob/72f2cec99f417b1a1c5e2e88945068983b7965f9/src/url-helper.ts#L22-L45

Note to maintainers

If accepted, It'd be happy to pick this up

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/tool-cache/src/tool-cache.ts at the hardcoded treeUrl construction, then compare the URL handling in actions/checkout's src/url-helper.ts. Trace getManifestFromRepo to confirm the generated request uses the configured GitHub Enterprise server URL instead of api.github.com. Done means GHE users can retrieve manifests without the github.com rate-limit failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
devops, tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.