@@ -18,8 +18,15 @@ pub enum Invocation {
18
18
pub ( super ) async fn parse_input (
19
19
_ctx : & Context ,
20
20
event : & IssuesEvent ,
21
- _config : Option < & MajorChangeConfig > ,
21
+ config : Option < & MajorChangeConfig > ,
22
22
) -> Result < Option < Invocation > , String > {
23
+ let config = if let Some ( config) = config {
24
+ config
25
+ } else {
26
+ return Ok ( None ) ;
27
+ } ;
28
+ let enabling_label = config. enabling_label . as_str ( ) ;
29
+
23
30
if event. action == IssuesAction :: Edited {
24
31
if let Some ( changes) = & event. changes {
25
32
if let Some ( previous_title) = & changes. title {
@@ -32,13 +39,12 @@ pub(super) async fn parse_input(
32
39
. issue
33
40
. labels ( )
34
41
. iter ( )
35
- . any ( |l| l. name == "major-change" )
42
+ . any ( |l| l. name == enabling_label )
36
43
{
37
44
return Ok ( Some ( Invocation :: Rename { prev_issue } ) ) ;
38
45
} else {
39
- // Ignore renamed issues without major-change label
40
- // to avoid warning about the major-change feature not being
41
- // enabled.
46
+ // Ignore renamed issues without primary label (e.g., major-change)
47
+ // to avoid warning about the feature not being enabled.
42
48
return Ok ( None ) ;
43
49
}
44
50
}
@@ -53,7 +59,7 @@ pub(super) async fn parse_input(
53
59
&& event
54
60
. label
55
61
. as_ref ( )
56
- . map_or ( false , |l| l. name == "major-change-accepted" )
62
+ . map_or ( false , |l| l. name == config . accept_label )
57
63
{
58
64
return Ok ( Some ( Invocation :: AcceptedProposal ) ) ;
59
65
}
@@ -69,12 +75,12 @@ pub(super) async fn parse_input(
69
75
. issue
70
76
. labels ( )
71
77
. iter ( )
72
- . any ( |l| l. name == "major-change" ) )
78
+ . any ( |l| l. name == enabling_label ) )
73
79
|| ( event. action == IssuesAction :: Labeled
74
80
&& event
75
81
. label
76
82
. as_ref ( )
77
- . map_or ( false , |l| l. name == "major-change" ) )
83
+ . map_or ( false , |l| l. name == enabling_label ) )
78
84
{
79
85
return Ok ( Some ( Invocation :: NewProposal ) ) ;
80
86
}
@@ -93,11 +99,14 @@ pub(super) async fn handle_input(
93
99
. issue
94
100
. labels ( )
95
101
. iter ( )
96
- . any ( |l| l. name == "major-change" )
102
+ . any ( |l| l. name == config . enabling_label )
97
103
{
98
104
let cmnt = ErrorComment :: new (
99
105
& event. issue ,
100
- "This is not a major change (it lacks the `major-change` label)." ,
106
+ format ! (
107
+ "This issue is not ready for proposals; it lacks the `{}` label." ,
108
+ config. enabling_label
109
+ ) ,
101
110
) ;
102
111
cmnt. post ( & ctx. github ) . await ?;
103
112
return Ok ( ( ) ) ;
@@ -152,7 +161,8 @@ pub(super) async fn handle_input(
152
161
let new_topic_url = crate :: zulip:: Recipient :: Stream {
153
162
id : config. zulip_stream ,
154
163
topic : & new_topic,
155
- } . url ( ) ;
164
+ }
165
+ . url ( ) ;
156
166
let breadcrumb_comment = format ! (
157
167
"The associated GitHub issue has been renamed. Please see the [renamed Zulip topic]({})." ,
158
168
new_topic_url
@@ -191,10 +201,17 @@ pub(super) async fn handle_command(
191
201
) -> anyhow:: Result < ( ) > {
192
202
let issue = event. issue ( ) . unwrap ( ) ;
193
203
194
- if !issue. labels ( ) . iter ( ) . any ( |l| l. name == "major-change" ) {
204
+ if !issue
205
+ . labels ( )
206
+ . iter ( )
207
+ . any ( |l| l. name == config. enabling_label )
208
+ {
195
209
let cmnt = ErrorComment :: new (
196
210
& issue,
197
- "This is not a major change (it lacks the `major-change` label)." ,
211
+ & format ! (
212
+ "This issue cannot be seconded; it lacks the `{}` label." ,
213
+ config. enabling_label
214
+ ) ,
198
215
) ;
199
216
cmnt. post ( & ctx. github ) . await ?;
200
217
return Ok ( ( ) ) ;
0 commit comments