From b9c3558fab468dd91d958397f87259e89020e54e Mon Sep 17 00:00:00 2001 From: mtfishman Date: Thu, 21 Nov 2024 19:21:35 -0500 Subject: [PATCH] Add Literate check workflow to template --- .../.github/workflows/LiterateCheck.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 templates/default/.github/workflows/LiterateCheck.yml diff --git a/templates/default/.github/workflows/LiterateCheck.yml b/templates/default/.github/workflows/LiterateCheck.yml new file mode 100644 index 0000000..32199d4 --- /dev/null +++ b/templates/default/.github/workflows/LiterateCheck.yml @@ -0,0 +1,35 @@ +name: Literate check +on: + push: + branches: [main] + tags: [v*] + pull_request: + +jobs: + literate: + name: "Literate Check" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: 1 + - name: Install Literate and generate docs + run: | + julia -e 'using Pkg; Pkg.add(PackageSpec(name="Literate"))' + julia -e 'using Literate; Literate.markdown("examples/README.jl", "docs/src"; flavor=Literate.DocumenterFlavor(), name="index")' + - name: Check if docs need to be updated + run: | + julia -e ' + out = Cmd(`git diff --name-only`) |> read |> String + if out == "" + exit(0) + else + @error "The documentation is outdated, rerun Literate to regenerate them." + write(stdout, out) + out_diff = Cmd(`git diff`) |> read |> String + @error "Diff:" + write(stdout, out_diff) + exit(1) + @error "" + end'