Skip to content

Commit

Permalink
use github token when available
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSDavidSoft committed Dec 15, 2022
1 parent 0e34d92 commit 5eaf0d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .github/workflows/vendor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion scripts/update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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])

Expand Down

0 comments on commit 5eaf0d0

Please sign in to comment.