Skip to content

Commit 256553c

Browse files
bors[bot]meili-bot
andauthored
Merge #401
401: Improve the check-release tag parser to be more robust r=bidoubiwa a=meili-bot _This PR is auto-generated._ The automated script generated this PR, which updates the check-release.sh script. ### Explaination `check-release.yml` used to parse the `GITHUB_REF` with `tr -d 'refs/tags/v'`. But, `tr` deletes characters and not a specific string. Which results in a wrong parsing of tags containings the characters present in `refs/tags/v`. Example: `refs/tags/v0.1.0-strapi-v3.1` becomes `0.1.0-pi-v3.1` To avoid this issue, the command is changed to a more robust parsing method: `cut -d '/' -f 3 | sed -r 's/^v//'` - `cut -d '/' -f 3` splits our string based on the `/` and takes the 3th element. `refs/tags/v0.1.0-strapi-v3.1` => `["refs", "tags", "v0.1.0-strapi-v3.1"]` - `sed -r 's/^v//'` removes the prepending `v`. `v0.1.0-strapi-v3.1` => `0.1.0-strapi-v3.1` Co-authored-by: meili-bot <[email protected]>
2 parents da7f4c2 + 0c755d0 commit 256553c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/scripts/check-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# Checking if current tag matches the package version
4-
current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v')
4+
current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//')
55
major=$(echo $current_tag | cut -d '.' -f1 )
66
minor=$(echo $current_tag | cut -d '.' -f2 )
77
cropped_current_tag="$major.$minor"

0 commit comments

Comments
 (0)