mirror of
https://github.com/theotherp/nzbhydra2.git
synced 2026-02-06 11:17:18 +00:00
First draft for checking github action before releasing
This commit is contained in:
parent
7643d0000b
commit
7d881a8dba
22
misc/check-github-action.ps1
Normal file
22
misc/check-github-action.ps1
Normal file
@ -0,0 +1,22 @@
|
||||
function Check-LatestGitHubActionRun {
|
||||
|
||||
# Set the base URL for the GitHub API
|
||||
$url = "https://api.github.com/repos/theotherp/nzbhydra2/actions/runs"
|
||||
|
||||
|
||||
# Send a GET request to the GitHub API to retrieve the list of workflow runs
|
||||
$response = Invoke-RestMethod -Uri $url -Method Get
|
||||
|
||||
# Get the latest workflow run
|
||||
$latestRun = $response.workflow_runs | Sort-Object -Property created_at -Descending | Select-Object -First 1
|
||||
|
||||
# Check the status of the latest workflow run
|
||||
if ($latestRun.conclusion -eq "failure") {
|
||||
Write-Output "The latest GitHub Actions run for the repository $owner/$repo failed."
|
||||
exit 1
|
||||
} else {
|
||||
Write-Output "The latest GitHub Actions run for the repository $owner/$repo was successful."
|
||||
}
|
||||
}
|
||||
|
||||
Check-LatestGitHubActionRun
|
||||
Loading…
Reference in New Issue
Block a user