Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add workflow to test readme generation #6359

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4c7fe0d
add workflow
virajbhartiya Nov 5, 2024
f76e551
Refactor README generation script
virajbhartiya Nov 7, 2024
5367945
Refactor README generation script and make check-missing-readme-gener…
virajbhartiya Nov 7, 2024
9308677
Merge branch 'master' into master
virajbhartiya Nov 7, 2024
5959247
Refactor README check workflow to include additional pull request events
virajbhartiya Nov 7, 2024
d4aefeb
Refactor README check workflow to include additional pull request events
virajbhartiya Nov 7, 2024
5b6b3e5
Merge branch 'master' into master
virajbhartiya Nov 7, 2024
041d143
Update .github/workflows/readme-check.yml
virajbhartiya Nov 7, 2024
12dcb4e
Refactor README check workflow to include additional pull request eve…
virajbhartiya Nov 7, 2024
a53f7a6
Merge branch 'master' into master
virajbhartiya Nov 7, 2024
071d218
exit on failing of cargo check
virajbhartiya Nov 7, 2024
c653b27
Merge branch 'master' into master
virajbhartiya Nov 7, 2024
ac46a73
Merge branch 'master' into master
virajbhartiya Nov 7, 2024
e17dc3d
Refactor README check script to exit on failing cargo check
virajbhartiya Nov 7, 2024
9cb75f9
Merge branch 'paritytech:master' into master
virajbhartiya Nov 7, 2024
6006948
Merge branch 'master' into master
iulianbarbu Nov 11, 2024
367a695
Update .github/workflows/readme-check.yml
virajbhartiya Nov 11, 2024
778709d
Update .github/workflows/readme-check.yml
virajbhartiya Nov 11, 2024
999289e
Update .github/scripts/check-missing-readme-generation.sh
virajbhartiya Nov 11, 2024
69708be
address reviews
virajbhartiya Nov 11, 2024
ca2718e
Update checks-quick.yml to install protobuf-compiler
virajbhartiya Nov 11, 2024
3bf7625
Merge branch 'master' into master
virajbhartiya Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/scripts/check-missing-readme-generation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
# Find all README.docify.md files
DOCIFY_FILES=$(find . -name "README.docify.md")

# Initialize a variable to track directories needing README regeneration
NEED_REGENERATION=""

for file in $DOCIFY_FILES; do
echo "Processing $file"

# Get the directory containing the docify file
DIR=$(dirname "$file")

# Go to the directory and run cargo build
cd "$DIR"
cargo check --features generate-readme || echo "Readme generation for $DIR failed. Ensure the crate compiles successfully and has a `generate-readme` feature which guards markdown compilation in the crate as follows: https://docs.rs/docify/latest/docify/macro.compile_markdown.html#conventions."
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved

# Check if README.md has any uncommitted changes
git diff --exit-code README.md

if [ $? -ne 0 ]; then
echo "Error: Found uncommitted changes in $DIR/README.md"
NEED_REGENERATION="$NEED_REGENERATION $DIR"
fi

# Return to the original directory
cd - > /dev/null
done

# Check if any directories need README regeneration
if [ -n "$NEED_REGENERATION" ]; then
echo "The following directories need README regeneration:"
echo "$NEED_REGENERATION"
exit 1
fi
31 changes: 31 additions & 0 deletions .github/workflows/readme-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Check README Updates

on:
push:
branches:
- master
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
workflow_dispatch:
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
check-readme:
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8 # v1.10.1
with:
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
cache: false
toolchain: stable
virajbhartiya marked this conversation as resolved.
Show resolved Hide resolved
components: cargo, clippy, rust-docs, rust-src, rustfmt, rustc, rust-std

- name: Find README.docify.md files and check generated READMEs
run: .github/scripts/check-missing-readme-generation.sh