@@ -55,6 +55,26 @@ function runTests(e, p) {
55
55
return notificationWrap ( build ( e , p ) , note )
56
56
}
57
57
58
+ // handleIssueComment handles an issue_comment event, parsing the comment
59
+ // text and determining whether or not to trigger a corresponding action
60
+ function handleIssueComment ( e , p ) {
61
+ if ( e . payload ) {
62
+ payload = JSON . parse ( e . payload ) ;
63
+
64
+ // Extract the comment body and trim whitespace
65
+ comment = payload . body . comment . body . trim ( ) ;
66
+
67
+ // Here we determine if a comment should provoke an action
68
+ switch ( comment ) {
69
+ case "/brig run" :
70
+ return runTests ( e , p ) ;
71
+ break ;
72
+ default :
73
+ console . log ( `No applicable action found for comment: ${ comment } ` ) ;
74
+ }
75
+ }
76
+ }
77
+
58
78
// A GitHub Check Suite notification
59
79
class Notification {
60
80
constructor ( name , e , p ) {
@@ -78,7 +98,7 @@ class Notification {
78
98
// Send a new notification, and return a Promise<result>.
79
99
run ( ) {
80
100
this . count ++
81
- var j = new Job ( `${ this . name } -${ this . count } ` , "deis /brigade-github-check-run:latest " ) ;
101
+ var j = new Job ( `${ this . name } -${ this . count } ` , "brigadecore /brigade-github-check-run:v0.1.0 " ) ;
82
102
j . imageForcePull = true ;
83
103
j . env = {
84
104
CHECK_CONCLUSION : this . conclusion ,
@@ -130,3 +150,5 @@ events.on("exec", (e, p) => {
130
150
events . on ( "check_suite:requested" , runSuite )
131
151
events . on ( "check_suite:rerequested" , runSuite )
132
152
events . on ( "check_run:rerequested" , runSuite )
153
+ events . on ( "issue_comment:created" , handleIssueComment ) ;
154
+ events . on ( "issue_comment:edited" , handleIssueComment ) ;
0 commit comments