Sanitize CI tag/ref before using it in file paths

github.ref_name for a workflow_dispatch run on a branch is the branch
name verbatim (e.g. claude/optimistic-davinci-2i411w), and PowerShell
treated the "/" as a path separator in Move-Item's destination,
failing with "Could not find a part of the path." Tag pushes (v0.2.0)
don't normally hit this, but sanitize unconditionally so manual runs
on any branch work too.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GYCT2RpUjFfBfp6CD4rREw
This commit is contained in:
Claude
2026-09-08 17:22:40 +00:00
parent 905487ce82
commit 7daf668a11
+2
View File
@@ -40,6 +40,8 @@ jobs:
run: | run: |
$tag = "${{ github.ref_name }}" $tag = "${{ github.ref_name }}"
if (-not $tag -or $tag -eq "main") { $tag = "manual" } if (-not $tag -or $tag -eq "main") { $tag = "manual" }
# Branch names (workflow_dispatch) can contain "/", which breaks file paths.
$tag = $tag -replace '[\\/]', '-'
# Rename Rust executable # Rename Rust executable
Move-Item SshHandlerRs/target/x86_64-pc-windows-msvc/release/ssh-handler.exe "./ssh-handler-rs-$tag.exe" Move-Item SshHandlerRs/target/x86_64-pc-windows-msvc/release/ssh-handler.exe "./ssh-handler-rs-$tag.exe"