action.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: 'Scan Patch Rejects'
  2. description: 'Collects .rej files into patch-rejects directory and outputs count'
  3. outputs:
  4. rej_count:
  5. value: ${{ steps.scan.outputs.rej_count }}
  6. runs:
  7. using: composite
  8. steps:
  9. - id: scan
  10. shell: bash
  11. run: |
  12. set -euo pipefail
  13. CONFIG_DIR="${{ github.workspace }}/kernel"
  14. REJECTS_DIR="${{ github.workspace }}/patch-rejects"
  15. mkdir -p "$REJECTS_DIR"
  16. mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
  17. FILTERED_REJS=()
  18. for REJ in "${REJS[@]}"; do
  19. REL="${REJ#"$CONFIG_DIR"/}"
  20. if [ "$(basename "$REL")" = "i2c-nomadik.c.rej" ]; then
  21. echo "Skipping $REL because it matches the ignored reject file"
  22. continue
  23. fi
  24. FILTERED_REJS+=("$REJ")
  25. done
  26. REJ_COUNT=${#FILTERED_REJS[@]}
  27. echo "REJ_COUNT=$REJ_COUNT" >> "$GITHUB_ENV"
  28. echo "rej_count=$REJ_COUNT" >> "$GITHUB_OUTPUT"
  29. if [ "$REJ_COUNT" -gt 0 ]; then
  30. for REJ in "${FILTERED_REJS[@]}"; do
  31. REL="${REJ#"$CONFIG_DIR"/}"
  32. DEST="$REJECTS_DIR/$REL"
  33. mkdir -p "$(dirname "$DEST")"
  34. cp "$REJ" "$DEST"
  35. ORIG="${REJ%.rej}"
  36. if [ -f "$ORIG" ]; then
  37. ORIG_DEST="$REJECTS_DIR/${REL%.rej}"
  38. mkdir -p "$(dirname "$ORIG_DEST")"
  39. cp "$ORIG" "$ORIG_DEST"
  40. fi
  41. echo "$REL" >> "$REJECTS_DIR/index.txt"
  42. done
  43. fi