Skip to content

Commit 7a64f21

Browse files
committed
rename gh_webhook_secret and update config.atd comments
1 parent 49c775c commit 7a64f21

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

documentation/secret_docs.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ Secret file is where sensitive information such as the urls used for webhooks an
4343
| value | description | optional | default |
4444
|-|-|-|-|
4545
| `slack_hooks` | list of webhook config objects | No | - |
46-
| `gh_token` | must not be specified for public repositories | Yes | - |
47-
| `gh_webhook_secret` | if not specified signatures will not be checked | Yes | - |
46+
| `gh_token` | specify to grant the bot access to private repositories; omit for public repositories | Yes | - |
47+
| `gh_hook_token` | specify to ensure the bot only receives GitHub notifications from pre-approved repositories | Yes | - |
4848

4949
## `gh_token`
5050

@@ -64,8 +64,8 @@ Some event notifications (e.g., status, commit comment) require a personal token
6464
For more detailed instructions on token generation, refer to https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line.
6565

6666

67-
## `gh_webhook_secret`
68-
For more information on `gh_webhook_secret` see [developer.github.com/webhooks/securing](https://developer.github.com/webhooks/securing/)
67+
## `gh_hook_token`
68+
For more information on `gh_hook_token` see [developer.github.com/webhooks/securing](https://developer.github.com/webhooks/securing/)
6969

7070
## Webhook Config
7171

lib/config.atd

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ type status_rules = {
88
rules: status_state;
99
}
1010

11-
(* This type of rule is used for CI build notifications. *)
11+
(* This type of rule is used for events that must be routed based on the
12+
files they are related to. *)
1213
type prefix_rules = {
13-
?default_channel : string nullable; (* if none of the rules is matching *)
14+
?default_channel: string nullable; (* if none of the rules is matching *)
1415
rules: prefix_rule list;
1516
}
1617

17-
(* This type of rule is used for events that must be routed based on the
18-
files they are related to. *)
18+
(* This type of rule is used for PR and issue notifications. *)
1919
type label_rules = {
20-
?default_channel : string nullable; (* if none of the rules is matching *)
20+
?default_channel: string nullable; (* if none of the rules is matching *)
2121
rules: label_rule list;
2222
}
2323

@@ -33,14 +33,14 @@ type config = {
3333

3434
(* This specifies the Slack webhook to query to post to the channel with the given name *)
3535
type webhook = {
36-
url : string; (* url to call to send the message *)
37-
channel : string; (* name of the channel where the message will be posted *)
36+
url : string; (* webhook URL to post the Slack message *)
37+
channel : string; (* name of the Slack channel to post the message *)
3838
}
3939

4040
(* This is the structure of the secrets file which stores sensitive information, and
4141
shouldn't be checked into version control. *)
4242
type secrets = {
4343
slack_hooks : webhook list;
44-
?gh_token : string option; (* must not be specified for public repositories *)
45-
?gh_webhook_secret : string option; (* if not specified - signatures will not be checked *)
44+
?gh_token : string option; (* GitHub personal access token, if repo access requires it *)
45+
?gh_hook_token : string option; (* GitHub webhook token to secure the webhook *)
4646
}

lib/config.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type t = {
1515
chans : string Chan_map.t;
1616
prefix_rules : Config_t.prefix_rules;
1717
label_rules : Config_t.label_rules;
18-
gh_webhook_secret : string option;
18+
gh_hook_token : string option;
1919
main_branch_name : string option;
2020
gh_token : string option;
2121
offline : string option;
@@ -89,7 +89,7 @@ let make (json_config : Config_t.config) (secrets : Config_t.secrets) =
8989
chans;
9090
prefix_rules = json_config.prefix_rules;
9191
label_rules = json_config.label_rules;
92-
gh_webhook_secret = secrets.gh_webhook_secret;
92+
gh_hook_token = secrets.gh_hook_token;
9393
main_branch_name = json_config.main_branch_name;
9494
gh_token = secrets.gh_token;
9595
offline = json_config.offline;

src/notabot.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let cfg_action_after_refresh (cfg : Config.t) =
1414
Rule.Prefix.print_prefix_routing cfg.prefix_rules.rules;
1515
log#info "using label routing:";
1616
Rule.Label.print_label_routing cfg.label_rules.rules;
17-
log#info "signature checking %s" (if Option.is_some cfg.gh_webhook_secret then "enabled" else "disabled")
17+
log#info "signature checking %s" (if Option.is_some cfg.gh_hook_token then "enabled" else "disabled")
1818

1919
let update_state_at_path state_path state event = State.save state_path @@ State.update_state state event
2020

0 commit comments

Comments
 (0)