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
  • Loading branch information
cesclass committed Jun 27, 2022
1 parent 8914024 commit 5607f0e
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: $PWD/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 use `script/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 use `script/update-index.sh`.; exit 101"

0 comments on commit 5607f0e

Please sign in to comment.