Fix GitHub API rate limit errors in test actions (#26489)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
This commit is contained in:
Copilot
2025-11-19 14:47:44 -08:00
committed by GitHub
co-authored by TravisEz13
parent d486365b24
commit 6928efb4c5
5 changed files with 28 additions and 4 deletions
+8 -2
View File
@@ -14,6 +14,9 @@ inputs:
required: false
default: ctrf
type: string
GITHUB_TOKEN:
description: 'GitHub token for API authentication'
required: true
runs:
using: composite
@@ -64,7 +67,10 @@ runs:
shell: pwsh
run: |-
Import-Module ./.github/workflows/GHWorkflowHelper/GHWorkflowHelper.psm1
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/Dsc/releases"
$headers = @{
Authorization = "Bearer ${{ inputs.GITHUB_TOKEN }}"
}
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/Dsc/releases" -Headers $headers
$latestRelease = $releases | Where-Object { $v = $_.name.trim("v"); $semVer = [System.Management.Automation.SemanticVersion]::new($v); if ($semVer.Major -eq 3 -and $semVer.Minor -ge 2) { $_ } } | Select-Object -First 1
$latestVersion = $latestRelease.tag_name.TrimStart("v")
Write-Host "Latest DSC Version: $latestVersion"
@@ -78,7 +84,7 @@ runs:
$tempPath = Get-GWTempPath
Invoke-RestMethod -Uri $downloadUrl -OutFile "$tempPath/DSC.tar.gz" -Verbose
Invoke-RestMethod -Uri $downloadUrl -OutFile "$tempPath/DSC.tar.gz" -Verbose -Headers $headers
New-Item -ItemType Directory -Path "$tempPath/DSC" -Force -Verbose
tar xvf "$tempPath/DSC.tar.gz" -C "$tempPath/DSC"
$dscRoot = "$tempPath/DSC"
+8 -2
View File
@@ -14,6 +14,9 @@ inputs:
required: false
default: ctrf
type: string
GITHUB_TOKEN:
description: 'GitHub token for API authentication'
required: true
runs:
using: composite
@@ -47,7 +50,10 @@ runs:
shell: pwsh
run: |-
Import-Module .\.github\workflows\GHWorkflowHelper\GHWorkflowHelper.psm1
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/Dsc/releases"
$headers = @{
Authorization = "Bearer ${{ inputs.GITHUB_TOKEN }}"
}
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/PowerShell/Dsc/releases" -Headers $headers
$latestRelease = $releases | Where-Object { $v = $_.name.trim("v"); $semVer = [System.Management.Automation.SemanticVersion]::new($v); if ($semVer.Major -eq 3 -and $semVer.Minor -ge 2) { $_ } } | Select-Object -First 1
$latestVersion = $latestRelease.tag_name.TrimStart("v")
Write-Host "Latest DSC Version: $latestVersion"
@@ -55,7 +61,7 @@ runs:
$downloadUrl = $latestRelease.assets | Where-Object { $_.name -like "DSC-*-x86_64-pc-windows-msvc.zip" } | Select-Object -First 1 | Select-Object -ExpandProperty browser_download_url
Write-Host "Download URL: $downloadUrl"
$tempPath = Get-GWTempPath
Invoke-RestMethod -Uri $downloadUrl -OutFile "$tempPath\DSC.zip"
Invoke-RestMethod -Uri $downloadUrl -OutFile "$tempPath\DSC.zip" -Headers $headers
$null = New-Item -ItemType Directory -Path "$tempPath\DSC" -Force
Expand-Archive -Path "$tempPath\DSC.zip" -DestinationPath "$tempPath\DSC" -Force
+4
View File
@@ -111,6 +111,7 @@ jobs:
with:
purpose: UnelevatedPesterTests
tagSet: CI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux_test_elevated_ci:
name: Linux Elevated CI
needs:
@@ -128,6 +129,7 @@ jobs:
with:
purpose: ElevatedPesterTests
tagSet: CI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux_test_unelevated_others:
name: Linux Unelevated Others
needs:
@@ -145,6 +147,7 @@ jobs:
with:
purpose: UnelevatedPesterTests
tagSet: Others
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
linux_test_elevated_others:
name: Linux Elevated Others
needs:
@@ -162,6 +165,7 @@ jobs:
with:
purpose: ElevatedPesterTests
tagSet: Others
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xunit_tests:
name: xUnit Tests
needs:
+4
View File
@@ -93,6 +93,7 @@ jobs:
with:
purpose: UnelevatedPesterTests
tagSet: CI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
macos_test_elevated_ci:
name: macOS Elevated CI
needs:
@@ -110,6 +111,7 @@ jobs:
with:
purpose: ElevatedPesterTests
tagSet: CI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
macos_test_unelevated_others:
name: macOS Unelevated Others
needs:
@@ -127,6 +129,7 @@ jobs:
with:
purpose: UnelevatedPesterTests
tagSet: Others
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
macos_test_elevated_others:
name: macOS Elevated Others
needs:
@@ -144,6 +147,7 @@ jobs:
with:
purpose: ElevatedPesterTests
tagSet: Others
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xunit_tests:
name: xUnit Tests
needs:
+4
View File
@@ -97,6 +97,7 @@ jobs:
with:
purpose: UnelevatedPesterTests
tagSet: CI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows_test_elevated_ci:
name: Windows Elevated CI
needs:
@@ -114,6 +115,7 @@ jobs:
with:
purpose: ElevatedPesterTests
tagSet: CI
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows_test_unelevated_others:
name: Windows Unelevated Others
needs:
@@ -131,6 +133,7 @@ jobs:
with:
purpose: UnelevatedPesterTests
tagSet: Others
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
windows_test_elevated_others:
name: Windows Elevated Others
needs:
@@ -148,6 +151,7 @@ jobs:
with:
purpose: ElevatedPesterTests
tagSet: Others
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
xunit_tests:
name: xUnit Tests
needs: