action.yml 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # .github/actions/set-kernel-config/action.yml
  2. name: Set Kernel Config
  3. description: Writes kernel config values into a fragment (NO defconfig edits)
  4. inputs:
  5. configs:
  6. required: true
  7. fragment:
  8. required: true
  9. runs:
  10. using: composite
  11. steps:
  12. - name: Apply configs
  13. shell: bash
  14. run: |
  15. set -euo pipefail
  16. FRAGMENT="${{ inputs.fragment }}"
  17. touch "${FRAGMENT}"
  18. set_config() {
  19. local input="$1"
  20. # trim whitespace
  21. input="$(echo "$input" | xargs)"
  22. [[ -z "$input" || "$input" == \#* ]] && return
  23. if [[ "$input" == *"="* ]]; then
  24. local config="${input%%=*}"
  25. local value="${input#*=}"
  26. else
  27. local config="$input"
  28. local value="y"
  29. fi
  30. # remove any existing entry (prevents duplicates/conflicts)
  31. sed -i "/^${config}=/d" "${FRAGMENT}"
  32. # write clean value
  33. echo "${config}=${value}" >> "${FRAGMENT}"
  34. }
  35. while IFS= read -r line; do
  36. set_config "$line"
  37. done <<< "${{ inputs.configs }}"