Skip to content

Commit

Permalink
chore: handle case where patch major doesn't exists
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Sep 19, 2024
1 parent 721dac7 commit fba9824
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/update-expected.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ jobs:
os=$(echo $patchName | grep -oP 'node-v[0-9.]+-(.*)-' | cut -d'-' -f3)
arch=$(echo $patchName | grep -oP 'node-v[0-9.]+-(.*)-(.*)' | cut -d'-' -f4)
# replace in shas.txt file the sha matching the same major, os and arch
sed -i -E "/$major[0-9.]+.-$os-$arch/c $sha $patchName" shas.txt
if grep -E -q "$major[0-9.]+.-$os-$arch" shas.txt; then
sed -i -E "/$major[0-9.]+.-$os-$arch/c $sha $patchName" shas.txt
else
# if file doesn't end with a newline, add it
if [ "$(tail -c 1 shas.txt)" != "" ]; then
echo "" >> shas.txt
fi
echo "$sha $patchName" >> shas.txt
fi
done
- name: Update expected shas
Expand Down

0 comments on commit fba9824

Please sign in to comment.