From 73cb0c45f142c67a1d01d6d72b1cea78eddafa92 Mon Sep 17 00:00:00 2001 From: Sewer56 Date: Sun, 10 Nov 2024 23:22:40 +0000 Subject: [PATCH] Improved: Don't accept empty lines as cargo paths --- action.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index be9bcb8..d652ac7 100644 --- a/action.yml +++ b/action.yml @@ -100,7 +100,16 @@ runs: if: inputs.crates-io-token != '' shell: bash run: | - while IFS= read -r path; do + # Trim whitespace and handle empty lines + echo "${{ inputs.rust-project-paths }}" | while read -r path || [[ -n "$path" ]]; do + # Skip empty lines + if [[ -z "$path" ]]; then + continue + fi + + # Trim whitespace + path=$(echo "$path" | xargs) + echo "Publishing Rust package at path: $path" - cargo publish --token ${{ inputs.crates-io-token }} ${{ inputs.additional-publish-params }} --manifest-path "$path/Cargo.toml" - done <<< "${{ inputs.rust-project-paths }}" \ No newline at end of file + cargo publish --token "${{ inputs.crates-io-token }}" ${{ inputs.additional-publish-params }} --manifest-path "$path/Cargo.toml" + done \ No newline at end of file