Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilabel #7

Open
wants to merge 3 commits into
base: alpha
Choose a base branch
from
Open

Multilabel #7

wants to merge 3 commits into from

Conversation

ednark
Copy link

@ednark ednark commented Jan 26, 2022

attempt to take into account multiple labels and use prefix from regex

Copy link
Member

@anairamzap-mobomo anairamzap-mobomo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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]?\
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we are missing the closing parenthesis for this group?

Copy link
Member

@anairamzap-mobomo anairamzap-mobomo Feb 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" " ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants