Skip to content

Commit 5eaf0d0

Browse files
committed
use github token when available
1 parent 0e34d92 commit 5eaf0d0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/vendor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ jobs:
3030

3131
- id: make-changes
3232
name: Checking for updates
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3335
run: |
3436
$currentVersion = (Get-Content .\vendor\sources.json | ConvertFrom-Json)
3537
. .\scripts\update.ps1 -verbose

scripts/update.ps1

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ function Fetch-DownloadUrl {
102102

103103
$p = $url.Segments.Split([Environment]::NewLine)
104104

105+
$headers = @{}
106+
107+
if ($($env:GITHUB_TOKEN)) {
108+
$headers["Authorization"] = "token $($env:GITHUB_TOKEN)"
109+
}
110+
105111
# Api server for GitHub
106112
$urlHost = "api.github.com"
107113

@@ -110,7 +116,7 @@ function Fetch-DownloadUrl {
110116

111117
$apiUrl = [uri] (New-Object System.UriBuilder -ArgumentList $url.Scheme, $urlHost, -1, $urlPath).Uri
112118

113-
$info = Invoke-RestMethod -Uri $apiUrl
119+
$info = Invoke-RestMethod -Uri $apiUrl -Headers $headers
114120

115121
$downloadLinks = (New-Object System.Collections.Generic.List[System.Object])
116122

0 commit comments

Comments
 (0)