Skip to content

Commit 40090b5

Browse files
khrmtekton-robot
authored andcommitted
Fix: CI job incorrectly skipped by file change detection
Updated the CI workflow to correctly detect changes in non-documentation and YAML files, preventing accidental skips of the CI job.
1 parent dbfd6c7 commit 40090b5

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,26 @@ jobs:
3737
3838
echo -e "Changed files:\n${CHANGED_FILES}"
3939
40-
# If no files are changed at all, then `grep -v` will match even though no change outputs
41-
# should be true. Skipping output on an empty set of changes eliminates the false positive
40+
# If there are no changed files, non-docs and yaml are not set and remain false by default.
41+
# This ensures that jobs depending on these outputs do not run when there are no changes.
4242
if [[ -n "${CHANGED_FILES}" ]]; then
43-
NON_DOCS=$(echo "${CHANGED_FILES}" | grep -Eqv '\.md$' && echo 'true' || echo 'false')
44-
YAML=$(echo "${CHANGED_FILES}" | grep -Eq '\.ya?ml$' && echo 'true' || echo 'false')
43+
NON_DOCS='false'
44+
YAML='false'
45+
46+
while read -r file; do
47+
if [[ "$file" != *.md ]]; then
48+
NON_DOCS='true'
49+
break
50+
fi
51+
done <<< "${CHANGED_FILES}"
52+
53+
while read -r file; do
54+
if [[ "$file" == *.yaml || "$file" == *.yml ]]; then
55+
YAML='true'
56+
break
57+
fi
58+
done <<< "${CHANGED_FILES}"
59+
4560
echo "non-docs=${NON_DOCS}" | tee -a $GITHUB_OUTPUT
4661
echo "yaml=${YAML}" | tee -a $GITHUB_OUTPUT
4762
fi

0 commit comments

Comments
 (0)