Skip to content

Commit d8a275f

Browse files
committed
Add GitHub workflow to show diff between HTML pages on push/PRs
1 parent b006e32 commit d8a275f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/diff.yml

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: HTML diff
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
diff:
9+
name: HTML diff
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- run: git config --global url."https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/".insteadOf "[email protected]/"
13+
14+
# check out base ref and build site into old/
15+
- uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event.pull_request.base.sha || github.event.repository.default_branch }}
18+
- run: make && mv build/ old/
19+
20+
# clean build files to remove any leftovers before building new version
21+
- run: make clean
22+
23+
# check out head ref and build site into new/
24+
- uses: actions/checkout@v4
25+
with:
26+
clean: false # Prevent removing files in old/
27+
- run: make && mv build/ new/
28+
29+
# Diff between old/ and new/
30+
- name: Diff between old/ and new/
31+
run: |
32+
git diff --no-index --stat --color=always old/ new/ && echo No changed detected || true
33+
diff -r -u --color=always old/ new/ || true

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build: public/src/tailwind.min.css
55
mkdir -p source/overrides
66
cp overrides/* source/overrides/
77
docker run --rm -i -v ${PWD}/source:/docs -u $(shell id -u) squidfunk/mkdocs-material:8.1.3 build
8-
cp -r source/build/docs/ build/
8+
cp -r source/build/docs/ build/ && rm build/docs/sitemap.xml.gz
99
cp public/.htaccess public/index.html build/
1010
cp public/src/* build/src/
1111

0 commit comments

Comments
 (0)