-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Relevant area(s)
WinGet CLI, PowerShell Module
Description of the new feature / enhancement
I am currently running into Github API limits when calling Repair-WinGetPackageManager in a Github Actions Pipeline: https://github.com/microsoft/windows-drivers-rs/actions/runs/20531244312/job/58982795057#step:3:43
It looks like API limits are significantly higher when calling the Github API w/ authenticated headers: https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28
It would be good for Winget's PWSH module to automatically use GH_TOKEN or GITHUB_TOKEN environment variables to authenticate Github CLI requests: https://docs.github.com/en/actions/tutorials/authenticate-with-github_token. The former is the environment variable automatically used by the official gh cli tool, and the latter is the environment variable automatically provided by Github actions
Proposed technical implementation details
Based on the official Github API library docs, it looks like this enhancement would just be as simple as checking those env variables, and then setting the token in the client object:
// accessToken is from env var
client.Credentials = new Credentials(accessToken);