Przeglądaj źródła

ci(apply-kernel-branding): fix output redirection in branding script

The sed command was incorrectly deleting the last line containing 'echo' and then appending the branding echo, which could lead to malformed scripts. Directly writing the echo command to the file ensures the script is correctly generated for Wild kernel variants.
TheWildJames 4 miesięcy temu
rodzic
commit
1bef322ed1
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      .github/actions/apply-kernel-branding/action.yml

+ 3 - 3
.github/actions/apply-kernel-branding/action.yml

@@ -24,11 +24,11 @@ runs:
         DEFCONFIG="${GITHUB_WORKSPACE}/kernel/common/arch/arm64/configs/gki_defconfig"
 
         if [ "${{ inputs.variant }}" = "Wild" ]; then
-          sed -i '${/^echo /d;}' scripts/setlocalversion
+          sed -i ':a; $!{N; ba}; s/\n\([^\n]*^echo [^\n]*\)\n$/\n/;' scripts/setlocalversion
           if [ "$(printf '%s\n' "${{ inputs.kernel_version }}" "6.6" | sort -V | head -n1)" = "6.6" ]; then
-            echo 'echo "${KERNELVERSION}-Wild"'
+            echo 'echo "${KERNELVERSION}-Wild"' >> scripts/setlocalversion
           else
-            echo 'echo "-Wild"'
+            echo 'echo "-Wild"' >> scripts/setlocalversion
           fi
         else
           if grep -q '^CONFIG_LOCALVERSION=' "$DEFCONFIG"; then