Skip to content

Commit 562796e

Browse files
committed
deprecate channel input because incoming webhooks are now locked to a channel by policy
1 parent 9023ee8 commit 562796e

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

.github/workflows/zhook.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
INPUT_WEBHOOKURL: ${{ secrets.ZHOOK_URL_DEV_NOTIFICATIONS }}
3434
INPUT_EVENTJSON: ${{ toJson(github.event) }}
3535
INPUT_SENDERUSERNAME: GitHubZ
36-
INPUT_DESTCHANNEL: dev-notifications
3736
INPUT_SENDERICONURL: https://github.com/fluidicon.png
3837
ZITI_LOG: 6
3938
TLSUV_DEBUG: 6
@@ -56,4 +55,3 @@ jobs:
5655
webhookUrl: ${{ secrets.ZHOOK_URL_DEV_NOTIFICATIONS }}
5756
eventJson: ${{ toJson(github.event) }}
5857
senderUsername: GitHubZ
59-
destChannel: dev-notifications

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ jobs:
3838

3939
eventJson: ${{ toJson(github.event) }}
4040
senderUsername: "GitHubZ"
41-
destChannel: "github-notifications"
4241
```
4342
4443
### Inputs

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
description: Identity JSON for an enrolled Ziti endpoint
99
required: true
1010
webhookUrl:
11-
description: URL for posting the payload
11+
description: Mattermost-channel-specific URL for posting the event
1212
required: true
1313
eventJson:
1414
description: GitHub event JSON (github.event)
@@ -22,9 +22,9 @@ inputs:
2222
required: false
2323
default: https://github.com/fluidicon.png
2424
destChannel:
25-
description: Mattermost channel
25+
description: Mattermost channel (deprecated because incoming webhooks are now locked to a channel)
2626
required: false
27-
default: dev-notifications
27+
default: null
2828
runs:
2929
using: docker
3030
image: Dockerfile

zhook.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ class MattermostWebhookBody:
2020
todoColor = "#FFFFFF"
2121
watchColor = "#FFD700"
2222

23-
def __init__(self, username, icon, channel, eventName, eventJsonStr, actionRepo):
23+
def __init__(self, username, icon, eventName, eventJsonStr, actionRepo):
2424
self.username = username
2525
self.icon = icon
26-
self.channel = channel
2726
self.eventName = eventName.lower()
2827
self.eventJsonStr = eventJsonStr
2928
self.actionRepo = actionRepo
@@ -36,7 +35,6 @@ def __init__(self, username, icon, channel, eventName, eventJsonStr, actionRepo)
3635
# "icon_url": self.icon,
3736
"username": self.senderJson['login'],
3837
"icon_url": self.senderJson['avatar_url'],
39-
"channel": self.channel,
4038
"props": {"card": f"```json\n{self.eventJsonStr}\n```"},
4139
}
4240

@@ -354,7 +352,6 @@ def dumpJson(self):
354352
eventJsonStr = os.getenv("INPUT_EVENTJSON")
355353
username = os.getenv("INPUT_SENDERUSERNAME")
356354
icon = os.getenv("INPUT_SENDERICONURL")
357-
channel = os.getenv("INPUT_DESTCHANNEL")
358355
actionRepo = os.getenv("GITHUB_ACTION_REPOSITORY")
359356
eventName = os.getenv("GITHUB_EVENT_NAME")
360357

@@ -421,7 +418,7 @@ def generate_json_schema(obj, max_depth=10, current_depth=0):
421418

422419
# Create webhook body
423420
try:
424-
mwb = MattermostWebhookBody(username, icon, channel, eventName, eventJsonStr, actionRepo)
421+
mwb = MattermostWebhookBody(username, icon, eventName, eventJsonStr, actionRepo)
425422
except Exception as e:
426423
print(f"Exception creating webhook body: {e}")
427424
raise e

0 commit comments

Comments
 (0)