update hooks

This commit is contained in:
Nico Alba
2026-05-08 22:40:32 +00:00
parent 01695e8ac3
commit 105d2e1ff5
2 changed files with 52 additions and 2 deletions
+26 -1
View File
@@ -1,6 +1,7 @@
name: mattermost-doc-alerts
on:
issues:
types: [opened, deleted, transferred, closed, reopened]
issue_comment:
pull_request_review:
types: [submitted]
@@ -19,13 +20,37 @@ jobs:
runs-on: ubuntu-latest
name: POST to doc-alerts
steps:
- name: Strip Vercel HTML from event JSON
id: preprocess
env:
EVENT_JSON: ${{ toJson(github.event) }}
run: |
python3 - << 'PYEOF'
import os, json, re
event = json.loads(os.environ['EVENT_JSON'])
body = (event.get('comment') or {}).get('body') or ''
if body:
event['comment']['body'] = re.sub(
r'\s*<a\b[^>]*vercel\.com[^>]*>.*?</a>',
'',
body,
flags=re.DOTALL | re.IGNORECASE,
).rstrip()
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
fh.write(f"event_json<<DELIM\n{json.dumps(event)}\nDELIM\n")
PYEOF
- uses: openziti/ziti-mattermost-action-py@v1
if: |
github.repository_owner == 'openziti'
&& ((github.event_name != 'pull_request_review')
|| (github.event_name == 'pull_request_review' && github.event.review.state == 'approved'))
&& !(
github.event_name == 'issue_comment'
&& github.event.sender.login == 'vercel[bot]'
&& (contains(github.event.comment.body, 'Building') || contains(github.event.comment.body, 'Ignored'))
)
with:
zitiId: ${{ secrets.ZITI_MATTERMOST_IDENTITY }}
webhookUrl: ${{ secrets.ZHOOK_URL_DOC_NOTIFICATIONS }}
eventJson: ${{ toJson(github.event) }}
eventJson: ${{ steps.preprocess.outputs.event_json }}
senderUsername: "GitHubZ"
+26 -1
View File
@@ -3,6 +3,7 @@ on:
create:
delete:
issues:
types: [opened, deleted, transferred, closed, reopened]
issue_comment:
pull_request_review:
types: [submitted]
@@ -23,14 +24,38 @@ jobs:
runs-on: ubuntu-latest
name: POST Webhook
steps:
- name: Strip Vercel HTML from event JSON
id: preprocess
env:
EVENT_JSON: ${{ toJson(github.event) }}
run: |
python3 - << 'PYEOF'
import os, json, re
event = json.loads(os.environ['EVENT_JSON'])
body = (event.get('comment') or {}).get('body') or ''
if body:
event['comment']['body'] = re.sub(
r'\s*<a\b[^>]*vercel\.com[^>]*>.*?</a>',
'',
body,
flags=re.DOTALL | re.IGNORECASE,
).rstrip()
with open(os.environ['GITHUB_OUTPUT'], 'a') as fh:
fh.write(f"event_json<<DELIM\n{json.dumps(event)}\nDELIM\n")
PYEOF
- uses: openziti/ziti-mattermost-action-py@v1
if: |
github.repository_owner == 'openziti'
&& ((github.event_name != 'pull_request_review')
|| (github.event_name == 'pull_request_review' && github.event.review.state == 'approved'))
&& !(
github.event_name == 'issue_comment'
&& github.event.sender.login == 'vercel[bot]'
&& (contains(github.event.comment.body, 'Building') || contains(github.event.comment.body, 'Ignored'))
)
with:
zitiId: ${{ secrets.ZITI_MATTERMOST_IDENTITY }}
webhookUrl: ${{ secrets.ZHOOK_URL_DEV_NOTIFICATIONS }}
eventJson: ${{ toJson(github.event) }}
eventJson: ${{ steps.preprocess.outputs.event_json }}
senderUsername: "GitHubZ"
destChannel: "dev-notifications"