Skip to content

Commit

Permalink
Normalise the JSON redirects file before diffing
Browse files Browse the repository at this point in the history
This ensures that key-ordering changes, which don't affect the
semantics of the file, don't create diff noise.
  • Loading branch information
PeterJCLaw committed Aug 3, 2024
1 parent b92333b commit fe5aa80
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,28 @@ jobs:
name: build-from-main
path: main

- name: Normalise JSON
shell: python
run: |
import json
from pathlib import Path
ROOTS = [
Path('main/_site'),
Path('local/_site'),
]
FILES = [
'redirects.json',
]
for root in ROOTS:
for name in FILES:
p = root / name
p.write_text(json.dumps(
json.loads(p.read_text()),
sort_keys=True,
))
- name: Diff
id: diff
run: |
Expand Down

0 comments on commit fe5aa80

Please sign in to comment.