Skip to content

Commit 1c56c2d

Browse files
committed
NO MESSAGE SET
1 parent dce8503 commit 1c56c2d

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,22 @@ jobs:
1919
with:
2020
fetch-depth: 0
2121

22-
- name: Modified files
22+
- name: check modified files
23+
id: check_files
2324
run: |
24-
case '${{ github.event_name }}' in
25-
push)
26-
changedFiles=$(git diff --name-only --diff-filter=d "${GITHUB_EVENT_BEFORE}" "${GITHUB_SHA}")
27-
;;
28-
pull_request)
29-
changedFiles=$(git diff --name-only --diff-filter=d "${GITHUB_EVENT_BASE_REF}" "${GITHUB_EVENT_HEAD_REF}")
30-
;;
31-
esac
32-
echo "$changedFiles"
25+
echo "=============== list modified files ==============="
26+
git diff --name-only HEAD^ HEAD
27+
28+
echo "========== check paths of modified files =========="
29+
git diff --name-only HEAD^ HEAD > files.txt
30+
while IFS= read -r file
31+
do
32+
echo $file
33+
if [[ $file != db/* ]]; then
34+
echo "This modified file is not under the 'db' folder."
35+
echo "::set-output name=run_job::false"
36+
break
37+
else
38+
echo "::set-output name=run_job::true"
39+
fi
40+
done < files.txt

0 commit comments

Comments
 (0)