From fae41172ed74d59b12dce87fad3c584b15676ea3 Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Sun, 19 May 2024 11:52:22 +0200 Subject: [PATCH 1/3] gen_docs_sidebar: redirect output to sidebar.md as part of the script The script should be self-sufficient (with no need to manually specify a redirection). This makes it easier to run it as part of pre-commit and CI. --- scripts/gen_docs_sidebar.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/gen_docs_sidebar.sh b/scripts/gen_docs_sidebar.sh index c7e0d29bf..2b354b54f 100755 --- a/scripts/gen_docs_sidebar.sh +++ b/scripts/gen_docs_sidebar.sh @@ -8,6 +8,7 @@ # The script will ignore any files that are not markdown files. # Usage: bash scripts/gen_docs_sidebar.sh > docs/_sidebar.md +{ echo "* [Readme](/)" for folder in $(find docs/*/ | sort -f); do @@ -29,3 +30,4 @@ for folder in $(find docs/*/ | sort -f); do done fi done +} > docs/_sidebar.md From 76dae63c695c948ee0352aadf86841d7d84e9bef Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Sun, 19 May 2024 11:42:18 +0200 Subject: [PATCH 2/3] Check that PRs have correctly ran the sidebar gen --- .gitlab-ci/lint.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitlab-ci/lint.yml b/.gitlab-ci/lint.yml index 5e4b81abb..2f96fec5f 100644 --- a/.gitlab-ci/lint.yml +++ b/.gitlab-ci/lint.yml @@ -89,6 +89,14 @@ markdownlint: script: - markdownlint $(find . -name '*.md' | grep -vF './.git') --ignore docs/_sidebar.md --ignore contrib/dind/README.md +generate-sidebar: + extends: .job + stage: unit-tests + tags: [light] + script: + - scripts/gen_docs_sidebar.sh + - git diff --exit-code + check-readme-versions: stage: unit-tests tags: [light] From 96bb0a3e1233a44fdf1b8ee4c2ad8de1346c35bd Mon Sep 17 00:00:00 2001 From: Max Gautier Date: Sun, 19 May 2024 12:04:07 +0200 Subject: [PATCH 3/3] sidebar_gen: force C locale If we don't, find output can change depending on system locale, which will produce inconsistent results. --- scripts/gen_docs_sidebar.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/gen_docs_sidebar.sh b/scripts/gen_docs_sidebar.sh index 2b354b54f..35379dbea 100755 --- a/scripts/gen_docs_sidebar.sh +++ b/scripts/gen_docs_sidebar.sh @@ -8,6 +8,7 @@ # The script will ignore any files that are not markdown files. # Usage: bash scripts/gen_docs_sidebar.sh > docs/_sidebar.md +export LANG=C { echo "* [Readme](/)"