Skip to content

Commit 2e9acc7

Browse files
committed
ci: sanitize RC tag input in release workflow
1 parent a5d53d0 commit 2e9acc7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,18 @@ jobs:
168168
runs-on: ubuntu-latest
169169
outputs:
170170
preid: ${{ steps.preid.outputs.preid }}
171+
tag: ${{ steps.tag.outputs.tag }}
171172
steps:
173+
- name: Sanitize tag
174+
id: tag
175+
run: |
176+
RAW_TAG="${{ github.event.inputs.tag }}"
177+
SAFE_TAG="$(echo "$RAW_TAG" | sed 's/[^0-9A-Za-z-]/-/g')"
178+
echo "tag=$SAFE_TAG" >> "$GITHUB_OUTPUT"
179+
172180
- name: Block production tags
173181
run: |
174-
if [ "${{ github.event.inputs.tag }}" = "latest" ]; then
182+
if [ "${{ steps.tag.outputs.tag }}" = "latest" ]; then
175183
echo "::error::Publishing with the 'latest' tag is not allowed for candidates. Use 'release' mode instead."
176184
exit 1
177185
fi
@@ -212,6 +220,6 @@ jobs:
212220
js-sdk: ${{ github.event.inputs.js-sdk == 'true' }}
213221
python-sdk: ${{ github.event.inputs.python-sdk == 'true' }}
214222
cli: ${{ github.event.inputs.cli == 'true' }}
215-
tag: ${{ github.event.inputs.tag }}
223+
tag: ${{ needs.rc-validate.outputs.tag }}
216224
preid: ${{ needs.rc-validate.outputs.preid }}
217225
secrets: inherit

0 commit comments

Comments
 (0)