diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa7375578d1..df475259549 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,8 +32,8 @@ jobs: uses: taiki-e/install-action@8484225d9734e230a8bf38421a4ffec1cc249372 # v2 with: tool: cargo-readme - - name: Run cargo readme - run: ./scripts/regenerate-readmes.sh + - name: Generate readmes + run: just generate-readmes - name: Check for differences run: git diff --exit-code # cargo hack might cause changes to Cargo.lock which can cause the git diff above to fail. Put diff --git a/Justfile b/Justfile index fc95acfb07e..62d124c3a79 100644 --- a/Justfile +++ b/Justfile @@ -24,3 +24,16 @@ rustdoc: | gawk '{ gsub(" v", "@", $0); printf("%s\n", $1); }' \ | xargs printf -- '-p %s\n' \ | RUSTC_BOOTSTRAP=1 RUSTDOCFLAGS='--cfg=doc_cfg' xargs cargo doc --no-deps --lib --all-features + +# Generate README.md files from README.tpl and lib.rs files +generate-readmes: + #!/usr/bin/env bash + set -eo pipefail + + git ls-files | grep README.tpl$ | while read -r readme; do + echo "Generating README for $readme" + dir=$(dirname "$readme") + cargo readme --project-root "$dir" > "$dir/README.md.tmp" + gawk -f "scripts/fix-readmes.awk" "$dir/README.md.tmp" > "$dir/README.md" + rm "$dir/README.md.tmp" + done diff --git a/scripts/regenerate-readmes.sh b/scripts/regenerate-readmes.sh deleted file mode 100755 index 4e698064531..00000000000 --- a/scripts/regenerate-readmes.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) The cargo-guppy Contributors -# SPDX-License-Identifier: MIT OR Apache-2.0 - -# Regenerate readme files in this repository. - -set -eo pipefail - -cd "$(git rev-parse --show-toplevel)" -git ls-files | grep README.tpl$ | while read -r readme; do - dir=$(dirname "$readme") - cargo readme --project-root "$dir" > "$dir/README.md.tmp" - gawk -f "scripts/fix-readmes.awk" "$dir/README.md.tmp" > "$dir/README.md" - rm "$dir/README.md.tmp" -done