From 10e70b495da337d3a60e5a072d9cf69dd4408c0f Mon Sep 17 00:00:00 2001 From: jjagusch Date: Mon, 15 Jun 2020 16:31:44 +0200 Subject: [PATCH 1/3] make labels configurable through env vars --- version-update.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/version-update.py b/version-update.py index 0c3bda9..ce05406 100644 --- a/version-update.py +++ b/version-update.py @@ -41,12 +41,18 @@ def retrieve_labels_from_merge_request(merge_request_id): return merge_request.labels def bump(latest): + + minor_bump_label = os.environ.get("MINOR_BUMP_LABEL") or "bump-minor" + major_bump_label = os.environ.get("MAJOR_BUMP_LABEL") or "bump-major" + merge_request_id = extract_merge_request_id_from_commit() labels = retrieve_labels_from_merge_request(merge_request_id) - if "bump-minor" in labels: + + + if minor_bump_label in labels: return semver.bump_minor(latest) - elif "bump-major" in labels: + elif major_bump_label in labels: return semver.bump_major(latest) else: return semver.bump_patch(latest) From 716799878fa188f5f3674ae3dd990e2ae86e99c8 Mon Sep 17 00:00:00 2001 From: jjagusch Date: Mon, 15 Jun 2020 16:32:03 +0200 Subject: [PATCH 2/3] add documentation about configuring labels through env vars --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fce90c..e514a24 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,9 @@ If git tags are available, it will determine whether to do a major, minor, or pa As stated above, the version update workflow relies on merge request labels to determine the new version. The `bump-minor` and `bump-major` labels have been set as global GitLab labels. However, global labels only propogate to groups created after setting a global label. When adding a global label, they [do not automatically propogate to existing groups](https://gitlab.com/gitlab-org/gitlab-ce/issues/12707). -If you cannot select the specified labels in your merge request, your group was most likely created before the global labels were defined. Please follow [this guide to setup group-specific labels](https://docs.gitlab.com/ee/user/project/labels.html) +If you cannot select the specified labels in your merge request, your group was most likely created before the global labels were defined. Please follow [this guide to setup group-specific labels](https://docs.gitlab.com/ee/user/project/labels.html). + +Tip: You can use custom labels for minor and major bumps by setting the `MINOR_BUMP_LABEL` and `MAJOR_BUMP_LABEL` environment variables. ### API token and group From 617f5734b6879a71aa0092dde4112941ce401b97 Mon Sep 17 00:00:00 2001 From: jjagusch Date: Tue, 16 Jun 2020 07:45:10 +0200 Subject: [PATCH 3/3] add information about label defaults --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e514a24..6bcada1 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ As stated above, the version update workflow relies on merge request labels to d If you cannot select the specified labels in your merge request, your group was most likely created before the global labels were defined. Please follow [this guide to setup group-specific labels](https://docs.gitlab.com/ee/user/project/labels.html). -Tip: You can use custom labels for minor and major bumps by setting the `MINOR_BUMP_LABEL` and `MAJOR_BUMP_LABEL` environment variables. +Tip: You can use custom labels for minor and major bumps by setting the `MINOR_BUMP_LABEL` and `MAJOR_BUMP_LABEL` environment variables. If not set, the default labels `bump-minor` and `bump-major` will be used. ### API token and group