A branch such as feature/foo produced an invalid Docker tag, so the build
aborted before it started. Replace invalid characters with a dash, strip
leading dots and dashes, and cap the length at 128. master still maps to
latest.
The branch name now reaches the shell through an env var, because a name
containing $(...) was previously executed by the step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>