Skip to content

Commit 0d6e618

Browse files
Ref: update diff check with new matching patterns (#5361)
* update diff check to ignore gitignore, ISSUE_TEMPLATE and update-deps.yml * test root gitignore * also skip for skip-ci * nit regex * refactor logic to accept a list of regex --------- Co-authored-by: Antonis Lilis <[email protected]>
1 parent c64a7af commit 0d6e618

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/skip-ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,21 @@ jobs:
4545
if: steps.check-pr.outputs.is-pr == 'true'
4646
id: check_diff
4747
run: |
48-
skipList=(".github/CODEOWNERS" ".prettierignore")
48+
skipList=(".github/CODEOWNERS" ".prettierignore" ".github/workflows/update-deps.yml" ".github/workflows/skip-ci.yml")
49+
skipRegList=("(.*/)?\.gitignore" "\.github/ISSUE_TEMPLATE.*")
50+
51+
for s in "${skipRegList[@]}"; do
52+
skipRegex+="$s|"
53+
done
54+
# Remove trailing |
55+
skipRegex=${skipRegex%|}
56+
4957
# Ignores changelog.md, readme.md,...
5058
fileChangesArray=($(git diff --name-only "$BASE_REF...$HEAD_REF" | grep -v '\.md$' || true))
5159
printf '%s\n' "${fileChangesArray[@]}"
5260
for item in "${fileChangesArray[@]}"
5361
do
54-
if [[ ! " ${skipList[@]} " =~ " ${item} " ]]; then
62+
if [[ ! " ${skipList[*]} " =~ " ${item} " ]] && [[ ! "${item}" =~ ^(${skipRegex})$ ]]; then
5563
echo "found '${item}' that doesn't belong to the skip list."
5664
exit 0
5765
fi

0 commit comments

Comments
 (0)