Skip to content

Commit

Permalink
Add script for verifying source code changes
Browse files Browse the repository at this point in the history
Also use the new script in the check-pr.yml workflow.
  • Loading branch information
jwakely committed Nov 21, 2024
1 parent d5afd6e commit ef04f5f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/check-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,15 @@ jobs:
path: html/issue*.html
retention-days: 7
if-no-files-found: ignore

- name: Check source code changes
continue-on-error: true
run: |
git fetch --depth 2 origin master
if ! git diff --quiet origin/master HEAD -- src
then
if ! bin/check-html-diffs.sh origin/master always
then
echo "::warning title=html-diffs::Generated HTML files do not match"
fi
fi
18 changes: 18 additions & 0 deletions bin/check-html-diffs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
old=$(mktemp -d ./mailing.old.XXXXXX)
new=$(mktemp -d ./mailing.new.XXXXXX)
echo Building lists at HEAD
make clean
make lists -j4
sed -i 's/Revised ....-..-.. at ..:..:.. UTC/Revised .../' mailing/*.html
mv mailing $new
git checkout ${1-origin/master} -- src
echo Building lists with code from `git rev-parse origin/master`
make clean
make lists -j4
git checkout HEAD -- src
sed -i 's/Revised ....-..-.. at ..:..:.. UTC/Revised .../' mailing/*.html
mv mailing $old
diff -u -r --color=${2:-auto} $old $new || exit
rm -r $old $new
echo No changes to HTML files

0 comments on commit ef04f5f

Please sign in to comment.