Skip to content

Commit

Permalink
Updated download_ap.ps1 to accept github api token
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed May 3, 2019
1 parent ff0e123 commit 7dc4f0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build/download_ap.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
# The AP.exe build to download from AppVeyor. Must be the CI build number (e.g. "314").
# .PARAMETER destination
# Where to "install" AP.exe to. Defaults to "/AP" ("C:\AP" on Windows)
# .PARAMETER github_api_token
# Provide this token to avoid rate limiting by the GitHub API.
# .EXAMPLE
# C:\> ./download_ap.ps1
# .EXAMPLE
Expand Down Expand Up @@ -45,7 +47,12 @@ param(
[string]$ci_build_number,

[Parameter()]
[string]$destination = "/AP"
[string]$destination = "/AP",

# GitHub API token used to bypass rate limiting
[Parameter()]
[string]
$github_api_token
)
$ErrorActionPreference = "Stop"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Expand Down Expand Up @@ -94,6 +101,7 @@ $script:oldWhatIfPreference = $WhatIfPreference
try {
$WhatIfPreference = $false
if ($source -eq "github") {
$headers = if ($github_api_token) { @{"Authorization" = "token $github_api_token"} } else { @{} }
$github_url = "https://api.github.com/repos/QutEcoacoustics/audio-analysis/releases"
if ($null -eq $exact_version) {
if ($package -eq "Stable") {
Expand All @@ -111,7 +119,7 @@ try {
$github_url += "/tags/v$exact_version"
}

$response = Invoke-RestMethod -Method Get -Uri $github_url
$response = Invoke-RestMethod -Method Get -Uri $github_url -Headers $headers
$response = $response | Select-Object -First 1
$asset_url = $response.assets `
| Where-Object { $_.name -like "$build*" } `
Expand Down
2 changes: 2 additions & 0 deletions scripts/ribbon_plot.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Creates a single image that shows ribbon plots stacked vertically
# Anthony Truskinger 2018
#
# [2019] Deprecated: see DrawRibbonPlot command
#
# For each image file with the phrase "SpectralRibbon" in it's name
# found in a given directory it:
# - Groups the image based on it's type (e.g. ACI-ENT-EVN)
Expand Down

0 comments on commit 7dc4f0e

Please sign in to comment.