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: fallback to "raw" endpoint for manifest when rate limit is reached #496

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Shegox
Copy link

@Shegox Shegox commented Aug 20, 2024

Description:
This PR leverages the raw endpoint (https://raw.githubusercontent.com/actions/go-versions/main/versions-manifest.json) to retrieve the golang manifest as a fallback mechanism. This allows GitHub Actions Runners, which have no API token and exceed the anonymous rate limit of 60 requests/hour/IP to still retrieve the manifest list without needing credentials.
This is especially helpful for GitHub Enterprise Server and self-hosted runners, as there multiple runners might share the same IP-address and quickly exceed the available rate limit. Supplying an access token for github.com is cumbersome, as it requires another technical user and the secret isn't exposed to forks, preventing builds from forks.
The implementation as a fallback mechanism minimizes the risk of breaking current workflows, as they will still use the normal API to retrieve the manifest.

Related issue:

This is similar to the implementation setup-python uses:

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

I have tested this on our GitHub Enterprise Server with success:

Attempting to download 1.20.0...
##[debug]No manifest cached
##[debug]Getting manifest from actions/go-versions@main
##[debug]Fetching the manifest via the API failed.
##[debug]API rate limit exceeded for xx.xx.xx.xx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
##[debug]Falling back to fetching the manifest using raw URL.
matching 1.20.0...
...
##[debug]matched 1.20.0
Acquiring 1.20.0 from https://github.com/actions/go-versions/releases/download/1.20.0-40721327[86](https://github.enterprise.com/xxxx/setup-go-test/actions/runs/7672571/job/29795181#step:4:87)/go-1.20.0-linux-x64.tar.gz

@priyagupta108 priyagupta108 self-assigned this Nov 5, 2024
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