1
- import gitconsensus . config
1
+ from gitconsensus import config
2
2
import datetime
3
3
import github3
4
4
import json
10
10
11
11
## Vote Totals
12
12
13
- | Yes | No | Total |
14
- | --- | -- | ----- |
15
- | %s | %s | %s |
13
+ | Yes | No | Abstain | Total |
14
+ | --- | -- | ------- | ----- |
15
+ | %s | %s | %s | %s |
16
+
16
17
17
18
## Vote Breakdown
18
19
19
20
%s
21
+
22
+
23
+ ## Vote Results
24
+
25
+ | Criteria | Result |
26
+ | ---------- | ------ |
27
+ | Has Quorum | %s |
28
+ | Has Votes | %s |
29
+
20
30
"""
21
31
22
32
@@ -161,9 +171,7 @@ def shouldClose(self):
161
171
def close (self ):
162
172
self .pr .close ()
163
173
self .addLabels (['gc-closed' ])
164
- table = self .buildVoteTable ()
165
- message = message_template % ('closed' , str (len (self .yes )), str (len (self .no )), str (len (self .users )), table )
166
- self .addComment (message )
174
+ self .commentAction ('closed' )
167
175
168
176
def vote_merge (self ):
169
177
self .pr .merge ('GitConsensus Merge' )
@@ -176,8 +184,21 @@ def vote_merge(self):
176
184
'gc-no %s' % (len (self .no ),),
177
185
'gc-age %s' % (self .daysSinceLastUpdate (),)
178
186
])
187
+ self .commentAction ('merged' )
188
+
189
+ def commentAction (self , action ):
179
190
table = self .buildVoteTable ()
180
- message = message_template % ('merged' , str (len (self .yes )), str (len (self .no )), str (len (self .users )), table )
191
+ consensus = self .repository .getConsensus ()
192
+ message = message_template % (
193
+ action ,
194
+ str (len (self .yes )),
195
+ str (len (self .no )),
196
+ str (len (self .abstain )),
197
+ str (len (self .users )),
198
+ table ,
199
+ consensus .hasQuorum (self ),
200
+ consensus .hasVotes (self )
201
+ )
181
202
self .addComment (message )
182
203
183
204
def buildVoteTable (self ):
0 commit comments