-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Download latest successful bpf_performance build (#2774)
* Download latest successful bpf_performance build Signed-off-by: Alan Jowett <[email protected]> * Fix path Signed-off-by: Alan Jowett <[email protected]> * Set GH_TOKEN environment variable Signed-off-by: Alan Jowett <[email protected]> * Download performance to it's own repo Signed-off-by: Alan Jowett <[email protected]> * PR feedback Signed-off-by: Alan Jowett <[email protected]> * Fix deploy script Signed-off-by: Alan Jowett <[email protected]> --------- Signed-off-by: Alan Jowett <[email protected]> Co-authored-by: Alan Jowett <[email protected]>
- Loading branch information
1 parent
0c93615
commit d5f4bd9
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) Microsoft Corporation | ||
# SPDX-License-Identifier: MIT | ||
|
||
# Script to pull artifact from latest scheduled run from a GitHub Actions workflow. | ||
|
||
param( | ||
[Parameter(Mandatory=$true)] [string] $ArtifactName, | ||
[Parameter(Mandatory=$true)] [string] $OutputPath, | ||
[Parameter(Mandatory=$true)] [string] $Owner, | ||
[Parameter(Mandatory=$true)] [string] $Repo, | ||
[Parameter(Mandatory=$false)] [string] $WorkflowName = "CI/CD", | ||
[Parameter(Mandatory=$false)] [string] $Branch = "main", | ||
[Parameter(Mandatory=$false)] [string] $RunId = $null) | ||
|
||
if ($null -eq (Get-Command 'gh.exe' -ErrorAction SilentlyContinue)) { | ||
throw "Unable to locate gh.exe. This command requires GitHub CLI installed and in your path." | ||
} | ||
|
||
if (!$runid) { | ||
# Get the latest run ID for the branch and workflow | ||
$run = ((Invoke-WebRequest -Uri "https://api.github.com/repos/$Owner/$Repo/actions/runs?per_page=1&exclude_pull_requests=true&branch=$Branch&status=completed&event=schedule&conclusion=success&name=$WorkflowName").Content | ConvertFrom-Json) | ||
$runid = $run.workflow_runs[0].id | ||
} | ||
|
||
Write-Output "Using run ID $runid in branch $Branch in repo $Owner/$Repo to fetch artifact $ArtifactName to $OutputPath." | ||
|
||
gh run download $runid -R "$Owner/$Repo" -n $ArtifactName -D $OutputPath |