reusable-workflows icon indicating copy to clipboard operation
reusable-workflows copied to clipboard

Add github-token to avoid CI failures due to rate limit

Open jsoref opened this issue 1 year ago • 2 comments

When I triggered CI, it failed:

https://github.com/check-spelling-sandbox/setup-java/actions/runs/12417595625/job/34668910196

FAIL __tests__/distributors/graalvm-installer.test.ts
  ● findPackageForDownload › version is 24-ea -> /^https:\/\/github\.com\/graalvm\/oracle-graalvm-ea-builds\/releases\/download\/jdk-24\.0\.0-ea\./

    Fetching version info for GraalVM EA builds from 'https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/24-ea.json?ref=main' failed with the error: API rate limit exceeded for 13.105.117.111. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)

      146 |         .result;
      147 |     } catch (err) {
    > 148 |       throw Error(
          |             ^
      149 |         `Fetching version info for GraalVM EA builds from '${url}' failed with the error: ${
      150 |           (err as Error).message
      151 |         }`

      at GraalVMDistribution.<anonymous> (src/distributions/graalvm/installer.ts:148:13)
          at Generator.throw (<anonymous>)
      at rejected (src/distributions/graalvm/installer.ts:29:65)

Adding the GITHUB_TOKEN would allow repositories that use this reusable workflow (such as actions/setup-java) to pass more reliably... https://github.com/check-spelling-sandbox/setup-java/pull/2

jsoref avatar Dec 20 '24 03:12 jsoref

Hi @jsoref 👋,

Thank you for your work on this PR. We’ve tested it with actions/setup-java, but unfortunately, we're still encountering failures due to GitHub API rate limiting. Here is a link to the test run for reference: Run.

It appears the changes in this PR aren’t resolving the issue as expected. Could you please review and let us know if there’s anything we might be missing in our configuration, or if there are any additional steps we should try?

priyagupta108 avatar Jul 16 '25 08:07 priyagupta108

@priyagupta108 that's because you don't appear to be using getOctokit.

Here's an example where someone uses it:

https://github.com/jd-solanki/gh-action-comment-on-new-issue/blob/c443e1151cc69b146fd6918cc983ec1bd27ab254/index.js#L3-L8

Note that with this, you'd have an octokit that could send credentials out. You'd then need to use octokit.rest.<...> or something. That's beyond what I'm up to doing. Afaict you're just using a generic http client.

I could be wrong, but you work for GitHub and are in the actions org, and I'm not. If the docs are unclear, you could file a bug against the toolkit folks to improve them.

My changes are correct, but clearly insufficient because you module is broken beyond the fact that your tests aren't passing credentials.

jsoref avatar Aug 01 '25 03:08 jsoref