Update labeller to set next version for main to be a minor release (#33671)

Signed-off-by: stianst <stianst@gmail.com>
This commit is contained in:
Stian Thorgersen 2024-10-08 09:00:59 +02:00 committed by GitHub
parent c3a74fa411
commit 5eb64456b5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,9 +25,11 @@ jobs:
echo "**PR:** [$PR_NUMBER](https://github.com/$GITHUB_REPOSITORY/pull/$PR_NUMBER)" >> $GITHUB_STEP_SUMMARY
if [ "$GITHUB_BASE_REF" == "main" ]; then
LAST_MAJOR="$(gh api /repos/$GITHUB_REPOSITORY/branches --paginate --jq .[].name | grep '^release/' | cut -d '/' -f 2 | cut -d '.' -f 1 | sort -n -r | head -n 1)"
NEXT_MAJOR="$(($LAST_MAJOR + 1))"
LABEL="release/$NEXT_MAJOR.0.0"
LAST_RELEASE="$(gh api /repos/$GITHUB_REPOSITORY/branches --paginate --jq .[].name | grep '^release/' | cut -d '/' -f 2 | sort -n -r | head -n 1)"
LAST_MINOR=$(echo $LAST_MINOR | cut -d '.' -f 2)
NEXT_MAJOR=$(echo $LAST_RELEASE | cut -d '.' -f 1)
NEXT_MINOR="$(($LAST_MINOR + 1))"
LABEL="release/$NEXT_MAJOR.$NEXT_MINOR.0"
BACKPORT_LABEL="backport/main"
elif [[ "$GITHUB_BASE_REF" = release/* ]]; then
MAJOR_MINOR="$(echo $GITHUB_BASE_REF | cut -d '/' -f 2)"