Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 5a5f129

Browse files
Ensure only docs files are modified (#1682)
1 parent 13689ac commit 5a5f129

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/pull-request-docs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,34 @@ on:
1010
- 'docs/**'
1111

1212
jobs:
13+
check_non_docs:
14+
outputs:
15+
run_all_github_action_checks: ${{ steps.check_files.outputs.run_all_github_action_checks }}
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 2
22+
23+
- name: check modified files
24+
id: check_files
25+
run: |
26+
echo "========== check paths of modified files =========="
27+
echo "::set-output name=run_all_github_action_checks::true"
28+
git diff --name-only HEAD^ HEAD > files.txt
29+
while IFS= read -r file
30+
do
31+
if [[ $file != docs/** ]]; then
32+
echo "Found modified non-'docs' file(s)"
33+
echo "::set-output name=run_all_github_action_checks::false"
34+
break
35+
fi
36+
done < files.txt
37+
1338
all_github_action_checks:
1439
runs-on: ubuntu-latest
40+
needs: check_non_docs
41+
if: needs.check_non_docs.outputs.run_all_github_action_checks == 'true'
1542
steps:
1643
- run: echo "Done"

0 commit comments

Comments
 (0)