|
61 | 61 |
|
62 | 62 |
|
63 | 63 | switch ($EventType) { |
| 64 | + $useRC = true; |
| 65 | + $useTeams = true; |
64 | 66 | case 'issues': |
65 | 67 | if ($RepositoryName == 'interserver/mailbaby-api-samples') { |
| 68 | + $useTeams = false; |
66 | 69 | break; |
67 | 70 | } |
68 | 71 | $Issue = $Message['issue']; |
|
78 | 81 | } |
79 | 82 |
|
80 | 83 | $Msg['text'] = $ChatMsg; |
81 | | - SendToChat('notifications', $Msg); |
| 84 | + SendToChat('notifications', $Msg, $useRC, $useTeams); |
82 | 85 | break; |
83 | 86 |
|
84 | 87 | case 'pull_request': |
|
96 | 99 | } |
97 | 100 |
|
98 | 101 | $Msg['text'] = $ChatMsg; |
99 | | - SendToChat('notifications', $Msg); |
| 102 | + SendToChat('notifications', $Msg, $useRC, $useTeams); |
100 | 103 | break; |
101 | 104 |
|
102 | 105 | case 'push': |
|
121 | 124 | } |
122 | 125 |
|
123 | 126 | $Msg['text'] = $ChatMsg; |
124 | | - SendToChat('notifications', $Msg); |
| 127 | + SendToChat('notifications', $Msg, $useRC, $useTeams); |
125 | 128 | break; |
126 | 129 |
|
127 | 130 | case 'check_suite': |
|
136 | 139 | . "([details]({$Url}))"; |
137 | 140 |
|
138 | 141 | $Msg['text'] = $ChatMsg; |
139 | | - //SendToChat('notifications', $Msg); |
| 142 | + //SendToChat('notifications', $Msg, $useRC, $useTeams); |
140 | 143 | break; |
141 | 144 |
|
142 | 145 | case 'workflow_run': |
|
151 | 154 | . "([view run]({$Url}))"; |
152 | 155 |
|
153 | 156 | $Msg['text'] = $ChatMsg; |
154 | | - //SendToChat('notifications', $Msg); |
| 157 | + //SendToChat('notifications', $Msg, $useRC, $useTeams); |
155 | 158 | break; |
156 | 159 |
|
157 | 160 | default: |
|
160 | 163 | . "on [{$RepositoryName}](https://github.com/{$RepositoryName})."; |
161 | 164 |
|
162 | 165 | $Msg['text'] = $ChatMsg; |
163 | | - SendToChat('notifications', $Msg); |
| 166 | + SendToChat('notifications', $Msg, $useRC, $useTeams); |
164 | 167 | break; |
165 | 168 | } |
166 | 169 | /* |
@@ -197,12 +200,10 @@ function WildMatch(string $string, string $expression) : bool |
197 | 200 | return preg_match('/^' . $expression . '$/', $string) === 1; |
198 | 201 | } |
199 | 202 |
|
200 | | -function SendToChat(string $Where, array $Payload) : bool |
| 203 | +function SendToChat(string $Where, array $Payload, $useRC = true, $useTeams = true) : bool |
201 | 204 | { |
202 | 205 | error_log("Sending Payload ".json_encode($Payload)." to {$Where}"); |
203 | 206 | global $chatChannels; |
204 | | - $useRC = true; |
205 | | - $useTeams = true; |
206 | 207 | if ($useRC === true) { |
207 | 208 | $Url = $chatChannels['rocketchat'][$Where]; |
208 | 209 | $c = curl_init(); |
|
0 commit comments