Skip to content

Commit 4ef5bb1

Browse files
authored
Merge pull request #98 from ahrefs/yasu/rename-allow-to-match
Rename `allow` to `match` for prefix/label rules in config file
2 parents 55045e5 + a340528 commit 4ef5bb1

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

documentation/config_docs.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,25 @@ Refer [here](https://docs.github.com/en/free-pro-team@latest/developers/webhooks
4343
"default_channel": "default",
4444
"rules": [
4545
{
46-
"allow": [
46+
"match": [
4747
"backend"
4848
],
4949
"channel": "backend"
5050
},
5151
{
52-
"allow": [
52+
"match": [
5353
"aa"
5454
],
5555
"channel": "aa-git"
5656
},
5757
{
58-
"allow": [
58+
"match": [
5959
"siren"
6060
],
6161
"channel": "siren"
6262
},
6363
{
64-
"allow": [],
64+
"match": [],
6565
"ignore": [
6666
"backend",
6767
"aa",
@@ -80,12 +80,12 @@ Refer [here](https://docs.github.com/en/free-pro-team@latest/developers/webhooks
8080

8181
### Label Rule
8282

83-
A **label rule** specifies whether or not a Slack channel should be notified, based on the labels present in the given payload. For each rule, `ignore` is a blacklist of labels that should not notify the rule's channel, and `allow` is a whitelist of labels that should. If a label exists in both lists, the `ignore` list takes precedence. If an empty `ignore` list is provided, nothing is ignored. If an empty `allow` list is provided, everything is allowed. Both are optional; if neither are provided, the rule will always generate a notification for its channel.
83+
A **label rule** specifies whether or not a Slack channel should be notified, based on the labels present in the given payload. For each rule, `ignore` is a blacklist of labels that should not notify the rule's channel, and `match` is a whitelist of labels that should. If a label exists in both lists, the `ignore` list takes precedence. If an empty `ignore` list is provided, nothing is ignored. If an empty `match` list is provided, everything is matched. Both are optional; if neither are provided, the rule will always generate a notification for its channel.
8484

8585
| value | description | optional | default |
8686
|-|-|-|-|
87-
| `allow` | if notifications match any label in this list, they should be routed to the channel | Yes | all labels allowed if no list provided |
88-
| `ignore` | if notifications match any label in this list, they shouldn't be routed to the channel (even if they match any allow labels) | Yes | - |
87+
| `match` | if notifications have any label in this list, they should be routed to the channel | Yes | all labels matched if no list provided |
88+
| `ignore` | if notifications have any label in this list, they shouldn't be routed to the channel (even if they have any `match` labels) | Yes | - |
8989
| `channel` | channel to use as webhook if the rule is matched | No | - |
9090

9191
## Prefix Options
@@ -98,13 +98,13 @@ A **label rule** specifies whether or not a Slack channel should be notified, ba
9898
"default_channel": "default",
9999
"rules": [
100100
{
101-
"allow": [
101+
"match": [
102102
"backend/api"
103103
],
104104
"channel": "aa"
105105
},
106106
{
107-
"allow": [
107+
"match": [
108108
"backend/megaindex",
109109
"backend/ahrefskit"
110110
],
@@ -119,12 +119,12 @@ A **label rule** specifies whether or not a Slack channel should be notified, ba
119119

120120
### Prefix Rule
121121

122-
A **prefix rule** specifies whether or not a Slack channel should be notified, based on the filenames present in the commits associated with the given payload. The semantics for the `allow` and `ignore` fields are the same as those for label rules (see above).
122+
A **prefix rule** specifies whether or not a Slack channel should be notified, based on the filenames present in the commits associated with the given payload. The semantics for the `match` and `ignore` fields are the same as those for label rules (see above).
123123

124124
| value | description | optional | default |
125125
|-|-|-|-|
126-
| `allow` | if commit files match any prefix in this list, they should be routed to the channel | Yes | all prefixes allowed if no list provided |
127-
| `ignore` | if commit files match any prefix in this list, they shouldn't be routed to the channel (even if they match any allow prefixes) | Yes | - |
126+
| `match` | if commit files have any prefix in this list, they should be routed to the channel | Yes | all prefixes matched if no list provided |
127+
| `ignore` | if commit files have any prefix in this list, they shouldn't be routed to the channel (even if they have any `match` prefixes) | Yes | - |
128128
| `channel` | channel to use as webhook if the rule is matched | No | - |
129129

130130
## Status Options

lib/rule.atd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type status_rule = {
6464
ignore should be ["some/other"]
6565
*)
6666
type prefix_rule = {
67-
?allow : string list nullable;
67+
?allow <json name="match"> : string list nullable;
6868
?ignore : string list nullable;
6969
channel_name <json name="channel"> : string;
7070
}
@@ -73,7 +73,7 @@ type prefix_rule = {
7373
and present in the allow list. Both `allow` and `ignore` are optional. If `allow`
7474
is undefined, then the rule matches all payloads. *)
7575
type label_rule = {
76-
?allow : string list nullable;
76+
?allow <json name="match"> : string list nullable;
7777
?ignore : string list nullable;
7878
channel_name <json name="channel"> : string;
7979
}

test/notabot.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,19 @@
2222
"default_channel": "default",
2323
"rules": [
2424
{
25-
"allow": [
25+
"match": [
2626
"backend/api"
2727
],
2828
"channel": "aa"
2929
},
3030
{
31-
"allow": [
31+
"match": [
3232
"backend/api/longest"
3333
],
3434
"channel": "longest-aa"
3535
},
3636
{
37-
"allow": [
37+
"match": [
3838
"backend/megaindex",
3939
"backend/ahrefskit"
4040
],
@@ -49,19 +49,19 @@
4949
"default_channel": "default",
5050
"rules": [
5151
{
52-
"allow": [
52+
"match": [
5353
"backend"
5454
],
5555
"channel": "backend"
5656
},
5757
{
58-
"allow": [
58+
"match": [
5959
"aa"
6060
],
6161
"channel": "aa-git"
6262
},
6363
{
64-
"allow": [
64+
"match": [
6565
"siren"
6666
],
6767
"channel": "siren"

0 commit comments

Comments
 (0)