Conversation
anairamzap-mobomo
left a comment
There was a problem hiding this comment.
@ednark I've just reviewed the changes and added some comments. Once we address those, I think we are good to merge this and test it with the dev release in our projects.
| NAT='0|[1-9][0-9]*' | ||
| SEMVER_REGEX="\ | ||
| ^[vV]?\ | ||
| ^([vV]?\ |
There was a problem hiding this comment.
I think here we are missing the closing parenthesis for this group?
There was a problem hiding this comment.
Ah, and also in here: I think we can replace that hardcoded "vV" with the $PREFIX env var that we are sending to this step
- run:
name: PR Semantic Versioning
environment:
SHA: $CIRCLE_SHA1
USER: << parameters.git-username >>
PREFIX: << parameters.tag-prefix >>
command: <<include(scripts/export-tag.sh)>>
So we would endup with something like:
SEMVER_REGEX="\
^(${PREFIX}?)\
($NAT)\\.($NAT)\\.($NAT)$"| LABEL="patch" | ||
| fi | ||
| # select all the labels of this PR | ||
| LABELS=$(curl -s -X GET -H "Authorization: token $GIT_USER_TOKEN" https://api.github.com/repos/"$REPO_NAME"/issues/"$PR_NUMBER"/labels | jq .[].name -r | grep -Ei "^(major|minor|patch)$" | tr '[:upper:]' '[:lower:]' | tr "\n" " ") |
There was a problem hiding this comment.
Here the github enpoint I think we are missing the repo owner. https://docs.github.com/en/rest/reference/repos#get-a-repository like:
https://api.github.com/repos/"$REPO_OWNER"/"$REPO_NAME"/issues/"$PR_NUMBER"/labels
We can get the repository owner/organization with the cicrcleci env var: $CIRCLE_PROJECT_USERNAME
attempt to take into account multiple labels and use prefix from regex