From 06c2ab235688a5eff753caa6de778ea3c1d464be Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 4 Nov 2024 22:08:37 +0000 Subject: [PATCH] Add script for verifying source code changes Also use the new script in the check-pr.yml workflow. --- .github/workflows/check-pr.yml | 12 ++++++++++++ bin/check-html-diffs.sh | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100755 bin/check-html-diffs.sh diff --git a/.github/workflows/check-pr.yml b/.github/workflows/check-pr.yml index df8acfed10..1bbaeb69eb 100644 --- a/.github/workflows/check-pr.yml +++ b/.github/workflows/check-pr.yml @@ -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 diff --git a/bin/check-html-diffs.sh b/bin/check-html-diffs.sh new file mode 100755 index 0000000000..bc5f4f79c6 --- /dev/null +++ b/bin/check-html-diffs.sh @@ -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