mirror of
https://github.com/EbookFoundation/free-programming-books.git
synced 2025-01-20 09:28:52 +00:00
fix: crash on empty changed files (#7059)
If a PR hasn't any changed file, the GitHub report fails with an exception Simulated evidence: https://github.com/davorpa/free-programming-books/actions/runs/3007631429 Fixed: https://github.com/davorpa/free-programming-books/actions/runs/3007755638
This commit is contained in:
parent
bba075a775
commit
222b3db615
@ -60,8 +60,18 @@ runs:
|
|||||||
# Loop ForEach files
|
# Loop ForEach files
|
||||||
$env:INPUT_FILES -split $env:INPUT_SEPARATOR | ForEach {
|
$env:INPUT_FILES -split $env:INPUT_SEPARATOR | ForEach {
|
||||||
$file = $_
|
$file = $_
|
||||||
|
if ($file -match "\s+" ) {
|
||||||
|
continue # is empty string
|
||||||
|
}
|
||||||
$abr_file = $env:INPUT_AB_ROOT + "/ab-results-" + ($file -replace "[/\\]","-") + "-markdown-table.json"
|
$abr_file = $env:INPUT_AB_ROOT + "/ab-results-" + ($file -replace "[/\\]","-") + "-markdown-table.json"
|
||||||
|
|
||||||
|
try {
|
||||||
$json = Get-Content $abr_file | ConvertFrom-Json
|
$json = Get-Content $abr_file | ConvertFrom-Json
|
||||||
|
} catch {
|
||||||
|
$message = $_
|
||||||
|
echo "::error ::$message" # Notify as GitHub Actions annotation
|
||||||
|
continue # Don't crash!!
|
||||||
|
}
|
||||||
|
|
||||||
$text += "`n`n"
|
$text += "`n`n"
|
||||||
if ("true" -eq $json.error) {
|
if ("true" -eq $json.error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user