Skip to content

ci: trim whitespace from tag input in release workflows#24

Merged
guibeira merged 1 commit intomainfrom
fix-release-tag-whitespace
Apr 9, 2026
Merged

ci: trim whitespace from tag input in release workflows#24
guibeira merged 1 commit intomainfrom
fix-release-tag-whitespace

Conversation

@guibeira
Copy link
Copy Markdown
Collaborator

@guibeira guibeira commented Apr 9, 2026

Summary

  • The iii-lsp/v1.0.0 release binary upload failed because the workflow_dispatch tag input had a leading space ( iii-lsp/v1.0.0)
  • softprops/action-gh-release trimmed the space when creating the release, but taiki-e/upload-rust-binary-action used the raw value — so gh release upload " iii-lsp/v1.0.0" couldn't find the release tagged iii-lsp/v1.0.0
  • Fix: pipe the tag input through xargs to trim whitespace, and use env: instead of inline ${{ }} to avoid shell injection

Test plan

  • Re-run the iii-lsp/v1.0.0 release via workflow_dispatch after merging
  • Verify binary assets appear on the release

Summary by CodeRabbit

  • Chores
    • Improved tag resolution in release workflows with whitespace normalization to ensure consistent and reliable handling across all release pipelines.

The workflow_dispatch tag input had a leading space (" iii-lsp/v1.0.0")
which caused taiki-e/upload-rust-binary-action to fail with "release
not found" — softprops/action-gh-release trims the tag when creating
the release, but the upload action used the raw value with the space.

Use env var + xargs to trim whitespace and prevent shell injection.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 9, 2026

📝 Walkthrough

Walkthrough

Three GitHub Actions release workflows are updated to normalize tag values by trimming whitespace before output. The tag resolution step now pipes the raw input through xargs to sanitize the value before being written to workflow outputs.

Changes

Cohort / File(s) Summary
Tag Resolution Normalization
.github/workflows/release-lsp-binary.yml, .github/workflows/release-lsp.yml, .github/workflows/release.yml
Updated "Resolve tag" step in the setup job to assign input to RAW_TAG, then normalize via xargs whitespace trimming before setting TAG output, replacing direct assignment pattern.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • andersonleal

Poem

🐰 With xargs' gentle touch, we trim the tag,
No whitespace shall lag our release's way,
Three workflows now dance in harmony,
Sanitized and clean, wild and free!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding whitespace trimming to tag inputs across three release workflows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-release-tag-whitespace

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/release-lsp.yml (1)

33-41: ⚠️ Potential issue | 🟡 Minor

Fail fast if the trimmed tag is empty.

If RAW_TAG is only whitespace, TAG becomes empty and later steps fail with less actionable errors. Add a guard immediately after Line [36].

Suggested patch
       run: |
         TAG=$(echo "$RAW_TAG" | xargs)
+        if [[ -z "$TAG" ]]; then
+          echo "::error::Tag is empty after trimming whitespace"
+          exit 1
+        fi
         echo "tag=$TAG" >> "$GITHUB_OUTPUT"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-lsp.yml around lines 33 - 41, The trimmed tag may
be empty when RAW_TAG contains only whitespace; add a guard right after the
TAG=$(echo "$RAW_TAG" | xargs) line to fail fast: check if TAG is empty (e.g.,
if [ -z "$TAG" ]), emit a clear error (echo "::error::Missing or empty tag from
RAW_TAG") and exit non-zero (exit 1) so the workflow stops before the "Extract
metadata from tag" (id: meta) step runs with an invalid TAG value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/release-lsp-binary.yml:
- Around line 37-41: After trimming RAW_TAG into TAG, add a guard that checks if
TAG is empty or only whitespace and, if so, emit a clear error to stderr and
exit non‑zero before writing to GITHUB_OUTPUT; update the script that uses
RAW_TAG/TAG in the workflow's run block to validate TAG (using the trimmed TAG
variable) and fail early with a descriptive message so downstream
metadata/release jobs don't run with an empty TAG.

In @.github/workflows/release.yml:
- Around line 37-41: After trimming RAW_TAG into TAG, add a guard that checks
TAG is non-empty and fails the job with a clear message if empty; specifically,
after TAG=$(echo "$RAW_TAG" | xargs) validate TAG and only echo "tag=$TAG" to
GITHUB_OUTPUT when non-empty, otherwise print an explanatory error and exit
non-zero to stop the workflow early (use the existing RAW_TAG, TAG and
GITHUB_OUTPUT symbols).

---

Outside diff comments:
In @.github/workflows/release-lsp.yml:
- Around line 33-41: The trimmed tag may be empty when RAW_TAG contains only
whitespace; add a guard right after the TAG=$(echo "$RAW_TAG" | xargs) line to
fail fast: check if TAG is empty (e.g., if [ -z "$TAG" ]), emit a clear error
(echo "::error::Missing or empty tag from RAW_TAG") and exit non-zero (exit 1)
so the workflow stops before the "Extract metadata from tag" (id: meta) step
runs with an invalid TAG value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 08f26cdb-2e8c-4d5c-bee8-da479bdb1d24

📥 Commits

Reviewing files that changed from the base of the PR and between 9c9a961 and 05489a7.

📒 Files selected for processing (3)
  • .github/workflows/release-lsp-binary.yml
  • .github/workflows/release-lsp.yml
  • .github/workflows/release.yml

Comment on lines +37 to 41
env:
RAW_TAG: ${{ inputs.tag || github.ref_name }}
run: |
TAG="${{ inputs.tag || github.ref_name }}"
TAG=$(echo "$RAW_TAG" | xargs)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Guard against whitespace-only dispatch input.

Line [40] can produce an empty TAG; add an explicit check to fail with a clear error before metadata/release jobs run.

Suggested patch
       run: |
         TAG=$(echo "$RAW_TAG" | xargs)
+        if [[ -z "$TAG" ]]; then
+          echo "::error::Tag is empty after trimming whitespace"
+          exit 1
+        fi
         echo "tag=$TAG" >> "$GITHUB_OUTPUT"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release-lsp-binary.yml around lines 37 - 41, After
trimming RAW_TAG into TAG, add a guard that checks if TAG is empty or only
whitespace and, if so, emit a clear error to stderr and exit non‑zero before
writing to GITHUB_OUTPUT; update the script that uses RAW_TAG/TAG in the
workflow's run block to validate TAG (using the trimmed TAG variable) and fail
early with a descriptive message so downstream metadata/release jobs don't run
with an empty TAG.

Comment on lines +37 to 41
env:
RAW_TAG: ${{ inputs.tag || github.ref_name }}
run: |
TAG="${{ inputs.tag || github.ref_name }}"
TAG=$(echo "$RAW_TAG" | xargs)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add an empty-tag guard after trimming.

After Line [40], validate TAG is non-empty so the workflow fails early with a clear message instead of failing downstream.

Suggested patch
       run: |
         TAG=$(echo "$RAW_TAG" | xargs)
+        if [[ -z "$TAG" ]]; then
+          echo "::error::Tag is empty after trimming whitespace"
+          exit 1
+        fi
         echo "tag=$TAG" >> "$GITHUB_OUTPUT"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
env:
RAW_TAG: ${{ inputs.tag || github.ref_name }}
run: |
TAG="${{ inputs.tag || github.ref_name }}"
TAG=$(echo "$RAW_TAG" | xargs)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
env:
RAW_TAG: ${{ inputs.tag || github.ref_name }}
run: |
TAG=$(echo "$RAW_TAG" | xargs)
if [[ -z "$TAG" ]]; then
echo "::error::Tag is empty after trimming whitespace"
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/release.yml around lines 37 - 41, After trimming RAW_TAG
into TAG, add a guard that checks TAG is non-empty and fails the job with a
clear message if empty; specifically, after TAG=$(echo "$RAW_TAG" | xargs)
validate TAG and only echo "tag=$TAG" to GITHUB_OUTPUT when non-empty, otherwise
print an explanatory error and exit non-zero to stop the workflow early (use the
existing RAW_TAG, TAG and GITHUB_OUTPUT symbols).

@guibeira guibeira merged commit d79a767 into main Apr 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant