Skip to content

Feature Request: Allow Authenticated Github API Requests #5949

@wmmc88

Description

@wmmc88

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Command-RepairIssue related to WinGet RepairIssue-FeatureThis is a feature request for the Windows Package Manager client.PowerShellIssue related to WinGet PowerShell Module or cmdlet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions