Skip to content

Commit

Permalink
Truncate changelog body to handle long sqldiffs
Browse files Browse the repository at this point in the history
  • Loading branch information
jzebedee committed Aug 24, 2023
1 parent 384d6ca commit 90bf467
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,11 @@ mv uscis.db "$(date +"%F").db"
sqldiff prev/*.db *.db > sqldiff.txt

# generate changelog
printf "$(<changelog-template.txt)" "$(basename prev/*.db .db)" "$(basename *.db .db)" "$(<sqldiff.txt)" > changelog.txt
sqldiff=$(<sqldiff.txt)
max_diff_length=124000
if [ $(wc -c <<< $sqldiff) -gt $max_diff_length ]
then
printf -v sqldiff '%.*s...\n\nTruncated for length' $max_diff_length "$(<sqldiff.txt)"
fi

printf "$(<changelog-template.txt)" "$(basename prev/*.db .db)" "$(basename *.db .db)" "$sqldiff" > changelog.txt

0 comments on commit 90bf467

Please sign in to comment.