Ver código fonte

refactor: enhance reject file handling by skipping ignored files in scan actions

TheWildJames 3 meses atrás
pai
commit
a23c73b874

+ 13 - 2
.github/actions/scan-patch-rejects/action.yml

@@ -16,12 +16,23 @@ runs:
         REJECTS_DIR="${{ github.workspace }}/patch-rejects"
         mkdir -p "$REJECTS_DIR"
         mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
-        REJ_COUNT=${#REJS[@]}
+        FILTERED_REJS=()
+
+        for REJ in "${REJS[@]}"; do
+          REL="${REJ#"$CONFIG_DIR"/}"
+          if [ "$(basename "$REL")" = "i2c-nomadik.c.rej" ]; then
+            echo "Skipping $REL because it matches the ignored reject file"
+            continue
+          fi
+          FILTERED_REJS+=("$REJ")
+        done
+
+        REJ_COUNT=${#FILTERED_REJS[@]}
         echo "REJ_COUNT=$REJ_COUNT" >> "$GITHUB_ENV"
         echo "rej_count=$REJ_COUNT" >> "$GITHUB_OUTPUT"
 
         if [ "$REJ_COUNT" -gt 0 ]; then
-          for REJ in "${REJS[@]}"; do
+          for REJ in "${FILTERED_REJS[@]}"; do
             REL="${REJ#"$CONFIG_DIR"/}"
             DEST="$REJECTS_DIR/$REL"
             mkdir -p "$(dirname "$DEST")"

+ 14 - 4
.github/workflows/main.yml

@@ -168,12 +168,20 @@ jobs:
             fi
 
             mapfile -t rej_files < <(find "$source_dir" -type f -name '*.rej' | sort)
-            if [ "${#rej_files[@]}" -eq 1 ]; then
-              rel_rej="${rej_files[0]#${source_dir}/}"
-              if [ "$rel_rej" = "common/mm/rmap.c.rej" ]; then
-                echo "Skipping $dirname because it only contains common/mm/rmap.c.rej"
+            filtered_rej_files=()
+            for rej_file in "${rej_files[@]}"; do
+              rel_rej="${rej_file#${source_dir}/}"
+              rel_name="$(basename "$rel_rej")"
+              if [ "$rel_rej" = "common/mm/rmap.c.rej" ] || [ "$rel_name" = "i2c-nomadik.c.rej" ]; then
+                echo "Skipping $rel_rej because it is an ignored reject file"
                 continue
               fi
+              filtered_rej_files+=("$rej_file")
+            done
+
+            if [ "${#filtered_rej_files[@]}" -eq 0 ]; then
+              echo "Skipping $dirname because it only contains ignored reject files"
+              continue
             fi
 
             mkdir -p "aio-rejects/$original_name"
@@ -183,6 +191,8 @@ jobs:
             else
               cp -r "$dir/." "aio-rejects/$original_name/"
             fi
+
+            find "aio-rejects/$original_name" -type f -name 'i2c-nomadik.c.rej' -delete
         done
 
         if [ "$(ls -A aio-rejects)" ]; then