Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

PR Summary

Test actions were hitting GitHub API rate limits (60 req/hr unauthenticated) when fetching DSC releases, causing CI failures:

API rate limit exceeded for 64.236.176.225. (But here's the good news: Authenticated 
requests get a higher rate limit. Check out the documentation for more details.)

Changes

Added GITHUB_TOKEN authentication to API calls in test actions:

  • Test actions (.github/actions/test/{nix,windows}/action.yml)

    • Added GITHUB_TOKEN input parameter
    • Created Authorization Bearer header for all Invoke-RestMethod calls
  • Workflows (.github/workflows/{linux,macos,windows}-ci.yml)

    • Pass ${{ secrets.GITHUB_TOKEN }} to test actions (12 job invocations)
$headers = @{
  Authorization = "Bearer ${{ inputs.GITHUB_TOKEN }}"
}
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/Dsc/releases" -Headers $headers

Authenticated requests have 5000 req/hr limit vs 60 unauthenticated.

PR Context

CI jobs intermittently fail when multiple test runs execute concurrently, exhausting the unauthenticated rate limit. Uses built-in GITHUB_TOKEN, no new secrets required.

PR Checklist

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/rate_limit
    • Triggering command: pwsh /tmp/test_api_auth.ps1 (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

On action.yml, Fix this issue

DOTNET_ROOT: C:\Program Files\dotnet

Invoke-RestMethod: D:\a_temp\bff241b3-3d7a-4512-9dd0-44f47b6bf716.ps1:3
Line |
3 | $releases = Invoke-RestMethod -Uri "https://api.github.com/repos/Powe
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| { "message": "API rate limit exceeded for 64.236.176.225. (But here\u0027s the good news: Authenticated
| requests get a higher rate limit. Check out the documentation for more details.)", "documentation_url":
| "https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting" }
Error: Process completed with exit code 1.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Add GITHUB_TOKEN input to nix and windows test actions
- Use Authorization header with Bearer token in all Invoke-RestMethod calls
- Pass GITHUB_TOKEN from workflows to test actions
- Fixes GitHub API rate limit errors by using authenticated requests

Co-authored-by: TravisEz13 <[email protected]>
Copilot AI changed the title [WIP] Fix API rate limit issue in action.yml Fix GitHub API rate limit errors in test actions Nov 19, 2025
Copilot AI requested a review from TravisEz13 November 19, 2025 21:43
@TravisEz13 TravisEz13 added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Nov 19, 2025
Copilot AI requested a review from TravisEz13 November 19, 2025 21:56
@TravisEz13 TravisEz13 marked this pull request as ready for review November 19, 2025 21:56
@TravisEz13 TravisEz13 requested review from a team and jshigetomi as code owners November 19, 2025 21:56
Copilot AI review requested due to automatic review settings November 19, 2025 21:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses GitHub API rate limit errors in test actions by adding authentication to API calls. Unauthenticated requests to the GitHub API are limited to 60 requests per hour, which CI jobs were exceeding when fetching DSC releases. By authenticating with the built-in GITHUB_TOKEN, the rate limit increases to 5,000 requests per hour.

Key changes:

  • Added GITHUB_TOKEN input parameter to test actions with Bearer authentication headers
  • Updated all Invoke-RestMethod calls to include the Authorization header
  • Passed secrets.GITHUB_TOKEN to test actions in 12 job invocations across Linux, macOS, and Windows CI workflows

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
.github/actions/test/windows/action.yml Added GITHUB_TOKEN input and Authorization header to both GitHub API calls (releases and asset download)
.github/actions/test/nix/action.yml Added GITHUB_TOKEN input and Authorization header to both GitHub API calls (releases and asset download)
.github/workflows/windows-ci.yml Passed GITHUB_TOKEN to 4 test job invocations (unelevated/elevated × CI/Others)
.github/workflows/macos-ci.yml Passed GITHUB_TOKEN to 4 test job invocations (unelevated/elevated × CI/Others)
.github/workflows/linux-ci.yml Passed GITHUB_TOKEN to 4 test job invocations (unelevated/elevated × CI/Others)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TravisEz13 TravisEz13 merged commit 6928efb into master Nov 19, 2025
60 of 105 checks passed
@TravisEz13 TravisEz13 deleted the copilot/fix-api-rate-limit-issue branch November 19, 2025 22:47
TravisEz13 added a commit to TravisEz13/PowerShell that referenced this pull request Nov 19, 2025
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: TravisEz13 <[email protected]>
SIRMARGIN pushed a commit to SIRMARGIN/PowerShell that referenced this pull request Dec 12, 2025
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: TravisEz13 <[email protected]>
kilasuit pushed a commit to kilasuit/PowerShell that referenced this pull request Jan 2, 2026
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: TravisEz13 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport-7.6.x-Migrated CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants