Skip to content

Commit 24c56b3

Browse files
cesclasserikmd
andcommitted
ci(check-update-index.yml): Add a workflow to check index.md
* The workflow check out the repo and execute update-index.sh. Then it check the diffs using git diff on index.md. Related: #490 Co-authored-by: Erik Martin-Dorel <[email protected]>
1 parent 2fdc853 commit 24c56b3

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: check-update-index
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- '**'
10+
11+
jobs:
12+
check-index:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repo
16+
uses: actions/checkout@v3
17+
18+
- name: Execute the script
19+
run: ./scripts/update-index.sh
20+
21+
- name: Check the diff
22+
run: echo diff_output="$(git diff --name-only "$PWD/docs/index.md")" >> "$GITHUB_ENV"
23+
24+
- name: Warning
25+
# if diff_output not null and master branch
26+
if: env.diff_output != '' && github.ref_name == 'master'
27+
run: "echo ::warning:: 'docs/index.md' outdated, please run 'scripts/update-index.sh'."
28+
29+
- name: Error
30+
# if diff_output not null and not master branch
31+
if: env.diff_output != '' && github.ref_name != 'master'
32+
run: "echo ::error:: 'docs/index.md' outdated, please run 'scripts/update-index.sh' and commit.; exit 1"

0 commit comments

Comments
 (0)