use github token when available

This commit is contained in:
David Refoua 2022-12-15 21:05:13 +00:00
parent 0e34d925ce
commit 5eaf0d0396
2 changed files with 9 additions and 1 deletions

View File

@ -30,6 +30,8 @@ jobs:
- id: make-changes
name: Checking for updates
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$currentVersion = (Get-Content .\vendor\sources.json | ConvertFrom-Json)
. .\scripts\update.ps1 -verbose

View File

@ -102,6 +102,12 @@ function Fetch-DownloadUrl {
$p = $url.Segments.Split([Environment]::NewLine)
$headers = @{}
if ($($env:GITHUB_TOKEN)) {
$headers["Authorization"] = "token $($env:GITHUB_TOKEN)"
}
# Api server for GitHub
$urlHost = "api.github.com"
@ -110,7 +116,7 @@ function Fetch-DownloadUrl {
$apiUrl = [uri] (New-Object System.UriBuilder -ArgumentList $url.Scheme, $urlHost, -1, $urlPath).Uri
$info = Invoke-RestMethod -Uri $apiUrl
$info = Invoke-RestMethod -Uri $apiUrl -Headers $headers
$downloadLinks = (New-Object System.Collections.Generic.List[System.Object])