You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docsrc/release-hinting.md
+26-7Lines changed: 26 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,15 @@ patch
19
19
20
20
## Release rules
21
21
22
-
There are four parts to a release rule: `match_result`, `no_match_result`, `grouping`and `path`. Only `match_result` is required, but without a `grouping`or `path` value, the rule is ignored. `no_match_result` defaults to `no-release`.
22
+
There are five parts to a release rule: `match_result`, `no_match_result`, `grouping`, `path`, and `branch`. Only `match_result` is required, but without a `grouping`, `path`, or `branch` value, the rule is ignored. `no_match_result` defaults to `no-release`.
23
23
24
24
### Match result
25
25
26
-
This is the hint returned if both the `grouping`and `path` values match. This is required.
26
+
This is the hint returned if the `grouping`, `path`and `branch` evaluations return `True`. This is required.
27
27
28
28
### No match result
29
29
30
-
This is the hint returned if either the `grouping` or `path` values do not match. By default, this is `no-release`.
30
+
This is the hint returned if any of the `grouping`, `path`, or `branch` evaluations return `False`. By default, this is `no-release`.
31
31
32
32
### Grouping
33
33
@@ -51,13 +51,32 @@ The value of {attr}`.ReleaseHint.grouping` will match the {attr}`.CommitContext.
51
51
52
52
The {attr}`.CommitContext.files` attribute is a `set` of paths relative to the repository root. The {attr}`.ReleaseHint.path` uses [globbing patterns](https://www.malikbrowne.com/blog/a-beginners-guide-glob-patterns) to match against {attr}`.CommitContext.files`.
53
53
54
+
### Branch
55
+
56
+
The {attr}`.ReleaseHint.branch` is a regular expression matched against the current branch. You can limit some release types to your primary branch, and others to non-primary branches.
57
+
54
58
## Examples
55
59
56
-
This will provide a "patch" hint if the grouping contains "Other", but only when a modified file is within the `src` directory. Otherwise it will provide a "no-release" hint.
60
+
This will provide a `patch` hint if the grouping contains "Other", but only when a modified file is within the `src` directory and the current branch is either `master` or `main`. Otherwise, it will provide a "no-release" hint.
57
61
58
62
```yaml
59
-
- match_result: "patch"
60
-
no_match_result: "no-release"
61
-
grouping: "Other"
63
+
- match_result: patch
64
+
no_match_result: no-release
65
+
grouping: Other
62
66
path: src/*
67
+
branch: master|main
68
+
```
69
+
This will provide a `dev` hint if the current branch is not `master` or `main`. For this to work all other rules must also specify a `branch` attribute. For example, `branch: master|main`.
70
+
71
+
```yaml
72
+
- match_result: dev
73
+
no_match_result: no-release
74
+
branch: ^((?!master|main).)*$
75
+
```
76
+
This will prevent any type of release if the current branch is not `master` or `main`. For this to work all other rules must also specify a `branch` attribute. For example, `branch: master|main`.
0 commit comments