Skip to content

Commit 5ab03b4

Browse files
authored
Merge pull request moby#3471 from zwpaper/dev-toc-ci
ci: add ci to check README toc
2 parents 1e1a9fc + 6a1e129 commit 5ab03b4

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Join `#buildkit` channel on [Docker Community Slack](https://dockr.ly/comm-slack
4242
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
4343
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
4444

45-
4645
- [Used by](#used-by)
4746
- [Quick start](#quick-start)
4847
- [Starting the `buildkitd` daemon](#starting-the-buildkitd-daemon)

hack/dockerfiles/generated-files.Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# syntax=docker/dockerfile-upstream:master
22

33
ARG GO_VERSION="1.19"
4+
ARG NODE_VERSION="19"
45
ARG PROTOC_VERSION="3.11.4"
56

67
# protoc is dynamically linked to glibc so can't use alpine base
@@ -53,3 +54,24 @@ RUN --mount=type=bind,target=.,rw \
5354
exit 1
5455
fi
5556
EOT
57+
58+
FROM node:${NODE_VERSION}-alpine AS doctoc
59+
RUN npm install -g doctoc
60+
WORKDIR /buildkit
61+
RUN --mount=type=bind,target=.,rw <<EOT
62+
doctoc README.md
63+
mkdir /out
64+
cp README.md /out/
65+
EOT
66+
67+
FROM base AS validate-toc
68+
RUN --mount=type=bind,target=.,rw \
69+
--mount=type=bind,from=doctoc,source=/out/README.md,target=./README.md <<EOT
70+
set -e
71+
diff=$(git status --porcelain -- 'README.md')
72+
if [ -n "$diff" ]; then
73+
echo >&2 'ERROR: The result of "doctoc" differs. Please update with "doctoc README.md"'
74+
echo "$diff"
75+
exit 1
76+
fi
77+
EOT

hack/validate-generated-files

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@ buildxCmd build \
88
--output "type=cacheonly" \
99
--file "./hack/dockerfiles/generated-files.Dockerfile" \
1010
.
11+
12+
buildxCmd build \
13+
--target "validate-toc" \
14+
--output "type=cacheonly" \
15+
--file "./hack/dockerfiles/generated-files.Dockerfile" \
16+
.

0 commit comments

Comments
 (0)