Skip to content

Commit

Permalink
ci(check-update-index.yml): Add a workflow to check index.md
Browse files Browse the repository at this point in the history
* The workflow check out the repo and execute update-index.sh.
  Then it check the diffs using git diff on index.md.

Related: ocaml-sf#490

Co-authored-by: Erik Martin-Dorel <erik@martin-dorel.org>
  • Loading branch information
cesclass and erikmd committed Jun 30, 2022
1 parent 2fdc853 commit 24c56b3
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/check-update-index.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: check-update-index

on:
push:
branches:
- master
pull_request:
branches:
- '**'

jobs:
check-index:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Execute the script
run: ./scripts/update-index.sh

- name: Check the diff
run: echo diff_output="$(git diff --name-only "$PWD/docs/index.md")" >> "$GITHUB_ENV"

- name: Warning
# if diff_output not null and master branch
if: env.diff_output != '' && github.ref_name == 'master'
run: "echo ::warning:: 'docs/index.md' outdated, please run 'scripts/update-index.sh'."

- name: Error
# if diff_output not null and not master branch
if: env.diff_output != '' && github.ref_name != 'master'
run: "echo ::error:: 'docs/index.md' outdated, please run 'scripts/update-index.sh' and commit.; exit 1"

0 comments on commit 24c56b3

Please sign in to comment.