mirror of
https://github.com/openziti/zrok.git
synced 2026-08-24 10:14:56 -05:00
update hooks
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user