forked from ocaml-sf/learn-ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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: ocaml-sf#490
- Loading branch information
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |