Skip to content

Commit

Permalink
Better error handling
Browse files Browse the repository at this point in the history
Raise any errors to the GH Action
  • Loading branch information
benlower committed Apr 26, 2024
1 parent eef92f2 commit f327fc8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,19 @@ jobs:

- name: Get data and update file
run: |
OUTPUT="$(node ./utils/GenerateLatestData.js)"
if [ -n "$OUTPUT" ]; then
OUTPUT="$(node ./utils/GenerateLatestData.js 2>err.txt)"
FILE="err.txt"
if [[ -f "$FILE" ]]; then
# Read the file contents and echo them so they are captured by the GitHub Actions runner
while read -r line; do
echo "$line"
done < "$FILE"
# Delete the file
rm "$FILE"
echo "File $FILE has been deleted."
exit 1
elif [ -n "$OUTPUT" ]; then
echo "$OUTPUT" > ./website/public/data/latest.json
git config --local user.email "[email protected]"
Expand Down

0 comments on commit f327fc8

Please sign in to comment.