Skip to content

Commit

Permalink
fix: crash on empty changed files (EbookFoundation#7059)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davorpa authored Sep 21, 2022
1 parent bba075a commit 222b3db
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .github/actions/awesomebot-gh-summary-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,18 @@ runs:
# Loop ForEach files
$env:INPUT_FILES -split $env:INPUT_SEPARATOR | ForEach {
$file = $_
if ($file -match "\s+" ) {
continue # is empty string
}
$abr_file = $env:INPUT_AB_ROOT + "/ab-results-" + ($file -replace "[/\\]","-") + "-markdown-table.json"
$json = Get-Content $abr_file | ConvertFrom-Json
try {
$json = Get-Content $abr_file | ConvertFrom-Json
} catch {
$message = $_
echo "::error ::$message" # Notify as GitHub Actions annotation
continue # Don't crash!!
}
$text += "`n`n"
if ("true" -eq $json.error) {
Expand Down

0 comments on commit 222b3db

Please sign in to comment.