@@ -40,36 +40,38 @@ jobs:
4040 exit 0
4141 fi
4242
43+
4344 # Extract excluded paths and add the 'codacy.yml' file itself
4445 EXCLUDES=$(yq '.exclude_paths[]' "$FILE_NAME")
45- STATIC_IGNORES=$' .github/**\n.codacy.yml'
46-
46+ BASE_PATTERNS="**"$'\n'"! .github/**"$'\n'"!$FILE_NAME"
47+ ALL_PATTERNS="$BASE_PATTERNS"$'\n'"$EXCLUDES"
4748
4849 # Build a paths-filter pattern
4950 PATTERNS="**"
5051
51- # Prexies with '!' for every exclusion in the file.
52- add_bang() {
53- while IFS= read -r line; do
54- if [[ -n "$line" ]]; then
55- PATTERNS="$PATTERNS"$'\n'"!$line"
56- fi
57- done <<< "$1"
58- }
59-
60- add_bang "$EXCLUDES"
61- add_bang "$STATIC_IGNORES"
52+ # Format the list
53+ FORMATTED_LIST="relevant_files:"
54+ while IFS= read -r line; do
55+ if [[ -n "$line" ]]; then
56+ # Formatea la línea para la lista YAML: - "!patron"
57+ PREFIX=""
58+ # Añade '!' si no es el patrón inicial '**'
59+ if [[ "$line" != "**" ]]; then
60+ PREFIX="!"
61+ fi
62+ FORMATTED_LIST="$FORMATTED_LIST"$'\n'"- ${PREFIX}$line"
63+ fi
64+ done <<< "$ALL_PATTERNS"
6265
6366 # Save the result on a variable
6467 {
6568 echo 'filters<<EOF'
66- echo "$PATTERNS "
69+ echo "$FORMATTED_LIST "
6770 echo 'EOF'
6871 } >> $GITHUB_OUTPUT
6972
70- # Display the result for debugging
71- echo "Generated Filters:"
72- echo "$PATTERNS"
73+ echo "Generated Filters (Final YAML Format):"
74+ echo "$FORMATTED_LIST"
7375
7476 # Verify if there are changes on relevant files
7577 # relevant_files will be:
7880 - uses : dorny/paths-filter@v3
7981 id : changes
8082 with :
81- filters : |
82- relevant_files:
83- ${{ steps.config.outputs.filters }}
83+ filters : ${{ steps.config.outputs.filters }}
8484
8585 # Bypass the 'Codacy Coverage Variation' when there are no relevant files able to trigger it.
8686 - name : Create Success Check for Variation
0 commit comments