diff --git a/.github/workflows/vendor.yml b/.github/workflows/vendor.yml index 0d3630c..1e8aecd 100644 --- a/.github/workflows/vendor.yml +++ b/.github/workflows/vendor.yml @@ -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 diff --git a/scripts/update.ps1 b/scripts/update.ps1 index 9eea219..1e6ccc1 100644 --- a/scripts/update.ps1 +++ b/scripts/update.ps1 @@ -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])