Skip to content

Commit 18ba343

Browse files
committed
feat(ci): Ensure that the README.md is in sync with internal/readme
1 parent 0e2abbb commit 18ba343

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/test.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,33 @@ jobs:
2727
fi
2828
echo "All Go files are properly formatted"
2929
30+
readme-check:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Set up Go
34+
uses: actions/setup-go@v5
35+
- name: Check out code
36+
uses: actions/checkout@v4
37+
- name: Check README is up-to-date
38+
run: |
39+
cd internal/readme
40+
make
41+
if [ -n "$(git status --porcelain)" ]; then
42+
echo "ERROR: README.md is not up-to-date!"
43+
echo ""
44+
echo "The README.md file differs from what would be generated by running 'make' in internal/readme/."
45+
echo "Please update internal/readme/README.src.md instead of README.md directly,"
46+
echo "then run 'make' in the internal/readme/ directory to regenerate README.md."
47+
echo ""
48+
echo "Changes:"
49+
git status --porcelain
50+
echo ""
51+
echo "Diff:"
52+
git diff
53+
exit 1
54+
fi
55+
echo "README.md is up-to-date"
56+
3057
test:
3158
runs-on: ubuntu-latest
3259
strategy:

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,19 @@ copyright header following the format below:
105105
// license that can be found in the LICENSE file.
106106
```
107107

108+
### Updating the README
109+
110+
The top-level `README.md` file is generated from `internal/readme/README.src.md`
111+
and should not be edited directly. To update the README:
112+
113+
1. Make your changes to `internal/readme/README.src.md`
114+
2. Run `make` in the `internal/readme/` directory to regenerate `README.md`
115+
3. Commit both files together
116+
117+
The CI system will automatically check that the README is up-to-date by running
118+
`make` and verifying no changes result. If you see a CI failure about the
119+
README being out of sync, follow the steps above to regenerate it.
120+
108121
## Code of conduct
109122

110123
This project follows the [Go Community Code of Conduct](https://go.dev/conduct).

0 commit comments

Comments
 (0)