Skip to content

Commit b713cd2

Browse files
committed
fix: ensure release label is used with semvar labels
Update README noting this new requirement Signed-off-by: jmeridth <[email protected]>
1 parent 0217cbf commit b713cd2

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

.github/workflows/release.yaml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,29 @@ jobs:
2727
create_release:
2828
# release if
2929
# manual deployment OR
30-
# merged to main and labelled with release labels
30+
# merged to main and labelled with release labels (breaking, feature, vuln) OR
31+
# merged to main and labelled with release + a semver label (major, minor, OR patch)
3132
if: |
32-
(github.event_name == 'workflow_dispatch') ||
33+
(
34+
github.event_name == 'workflow_dispatch') ||
3335
(github.event.pull_request.merged == true &&
34-
(contains(github.event.pull_request.labels.*.name, 'breaking') ||
36+
(
37+
contains(github.event.pull_request.labels.*.name, 'breaking') ||
3538
contains(github.event.pull_request.labels.*.name, 'feature') ||
36-
contains(github.event.pull_request.labels.*.name, 'vuln') ||
37-
contains(github.event.pull_request.labels.*.name, 'release')))
39+
contains(github.event.pull_request.labels.*.name, 'vuln')
40+
) ||
41+
(
42+
contains(github.event.pull_request.labels.*.name, 'release') &&
43+
contains(github.event.pull_request.labels.*.name, 'major')
44+
) ||
45+
(
46+
contains(github.event.pull_request.labels.*.name, 'release') &&
47+
contains(github.event.pull_request.labels.*.name, 'minor')
48+
) ||
49+
(
50+
contains(github.event.pull_request.labels.*.name, 'release') &&
51+
contains(github.event.pull_request.labels.*.name, 'patch')
52+
))
3853
outputs:
3954
full-tag: ${{ steps.release-drafter.outputs.tag_name }}
4055
short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ This is a placeholder repo for multiple GitHub Actions we use in open source pro
1818
>
1919
> [Workflows](.github/workflows)
2020
21-
> [!CAUTION]
22-
> In our default `release-drafter.yaml` file and hardcoded in our `release.yaml` reusable workflow, we use the labels `major`, `minor`, and `patch` to determine the type of release to create. Unfortunately, Dependabot uses these same labels, by default, on its PRs to indicate the type of version update. This can cause unintended releases to be created when Dependabot PRs are merged.
23-
> The "fix" is to include `labels: ["package-name", "dependencies"]` in your `dependabot.yaml` configuration file to ensure Dependabot PRs are labeled correctly and do not use the `major`, `minor`, or `patch` labels.
24-
> You can see an example of this in the [dependabot.yaml](.github/dependabot.yaml) file in this repository.
21+
> [!TIP]
22+
> In order to update the semver version of a release both the `release` and a semver label (`major`, `minor`, or `patch`) must be used on the pull request that is merged to `main`.
23+
>
24+
> This is to prevent accidental version bumps from pull requests that are not intended to be releases. (example: Dependabot PRs that label themselves with semver labels)
2525
2626
> [!TIP]
2727
> You can reuse the following files in this repository in your own as they are used by the reusable workflows:

0 commit comments

Comments
 (0)