Skip to content

flank makes unauthenticated requests to github API #2344

@andreschab90

Description

@andreschab90

Describe the bug

A clear and concise description of what the bug is.

  • it seems that flank is doing unauthenticated requests to github API in their github actions, even when GITHUB_TOKEN is present on the machine. The rate limit is therefore only 60 requests per hour.

To Reproduce

Steps to reproduce the behavior:

  • add flank step to your workflow
  • trigger workflow multiple times
  • if you hit the rate limit for unauthenticated requests, then build will fail

Expected behavior

A clear and concise description of what you expected to happen.

  • flank should use GITHUB_TOKEN to make authenticated requests
  • step should not fail when hitting unauthenticated rate limit

Details (please complete the following information):

Have you tested on the latest Flank snapshot?
yes
Post the output of flank --version.
v23.01.0

Additional context

Add any other context about the problem here.

Run Flank/flank@master
Run curl -L https://github.com/Flank/flank/releases/download/flank-scripts-1.9.1/flank-scripts.jar --output flank-scripts.jar
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

77 15.8M 77 12.3M 0 0 16.5M 0 --:--:-- --:--:-- --:--:-- 16.5M
100 15.8M 100 15.8M 0 0 20.3M 0 --:--:-- --:--:-- --:--:-- 110M
Run ./flankScripts github download_flank --version=
Exception in thread "main" Error while doing GitHub request, because of API rate limit exceeded for 199.19.85.81. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.), more info at https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting
at flank.scripts.utils.exceptions.FlankScriptsExceptionMappersKt.toGithubException(FlankScriptsExceptionMappers.kt:17)
at flank.scripts.utils.exceptions.FlankScriptsExceptionMappersKt$mapClientErrorToGithubException$1.invoke(FlankScriptsExceptionMappers.kt:15)
at flank.scripts.utils.exceptions.FlankScriptsExceptionMappersKt$mapClientErrorToGithubException$1.invoke(FlankScriptsExceptionMappers.kt)
at flank.scripts.utils.exceptions.FlankScriptsExceptionMappersKt.mapClientError(FlankScriptsExceptionMappers.kt:11)
at flank.scripts.utils.exceptions.FlankScriptsExceptionMappersKt.mapClientErrorToGithubException(FlankScriptsExceptionMappers.kt:15)
at flank.scripts.data.github.GithubApiKt.getLatestReleaseTag(GithubApi.kt:58)
at flank.scripts.data.github.GithubApiKt$getLatestReleaseTag$1.invokeSuspend(GithubApi.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:84)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
at flank.scripts.cli.github.DownloadFlankCommand.run(DownloadFlankCommand.kt:19)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:170)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:179)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:179)
at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:16)
at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:258)
at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:255)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:273)
at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:298)
at flank.scripts.cli.MainKt.main(Main.kt:29)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions