Skip to content

Commit 9f6dd5c

Browse files
feat(ci): Ensure that the README.md is in sync with internal/readme (#53)
1 parent 0e2abbb commit 9f6dd5c

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/readme-check.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: README Check
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
paths:
6+
- 'internal/readme/**'
7+
- 'README.md'
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
readme-check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
- name: Check out code
19+
uses: actions/checkout@v4
20+
- name: Check README is up-to-date
21+
run: |
22+
cd internal/readme
23+
make
24+
if [ -n "$(git status --porcelain)" ]; then
25+
echo "ERROR: README.md is not up-to-date!"
26+
echo ""
27+
echo "The README.md file differs from what would be generated by running 'make' in internal/readme/."
28+
echo "Please update internal/readme/README.src.md instead of README.md directly,"
29+
echo "then run 'make' in the internal/readme/ directory to regenerate README.md."
30+
echo ""
31+
echo "Changes:"
32+
git status --porcelain
33+
echo ""
34+
echo "Diff:"
35+
git diff
36+
exit 1
37+
fi
38+
echo "README.md is up-to-date"

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)