evergreen icon indicating copy to clipboard operation
evergreen copied to clipboard

Update Get-GitHubRepoRelease to support authenticated sessions to GitHub

Open aaronparker opened this issue 3 years ago • 7 comments

Get-GitHubRepoRelease has been updated to handle rate limiting for unauthenticated sessions to the GitHub API. Authenticated sessions to the API are not rate limited, thus Get-GitHubRepoRelease could be updated to support authenticated sessions to fix scenarios where rate limiting kicks in.

Ref: https://github.com/aaronparker/evergreen/blob/07606fe401feccef723a72ecf520948135017cdb/Evergreen/Private/Get-GitHubRepoRelease.ps1#L56

Ref: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting

aaronparker avatar Jun 26 '21 00:06 aaronparker

Is there any ETA on this feature?

vackodegamma avatar Oct 26 '21 20:10 vackodegamma

Not at the moment, there's several features and application that are ahead of this. Do you need to make more requests to GitHub than 60 in 60 mins?

aaronparker avatar Oct 27 '21 06:10 aaronparker

Yes, but that's a pretty niche use case. I'm using evergreen as a part of up-to-date package repository and run it for the applications every day.

Authenticated sessions would be nice to have in the future, but I can work around it by splitting the work into two staggered jobs.

On Wed, Oct 27, 2021, 08:32 Aaron Parker @.***> wrote:

Not at the moment, there's several features and application that are ahead of this. Do you need to make more requests to GitHub than 60 in 60 mins?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aaronparker/evergreen/issues/195#issuecomment-952584460, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHPPVEB5PHLOM7XLABBC4VTUI6MH5ANCNFSM47KYUUPQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

vackodegamma avatar Oct 27 '21 06:10 vackodegamma

Thanks, use case makes sense.

aaronparker avatar Oct 27 '21 07:10 aaronparker

Thinking about how to implement this. The simplest approach might be to get Get-GitHubRepoRelease to check for an environment variable call GITHUB_TOKEN. That way it would work when a token is added manually and would also work when run in a GitHub workflow. This would be a simple way to add support for authentication to the GitHub API with a personal access token.

aaronparker avatar Jun 18 '22 12:06 aaronparker

You can check for both GITHUB_TOKEN and GH_TOKEN. The second one is also very commonly used.

vedantmgoyal9 avatar Jun 18 '22 12:06 vedantmgoyal9

Support for a token stored in GITHUB_TOKEN added in 83c605b495e60b3bc4acccb2878f6b1a6e05c56c. Tests OK.

aaronparker avatar Jun 18 '22 23:06 aaronparker