Skip to content

resource-published #963

resource-published

resource-published #963

name: Slack Publish Notifications
on:
repository_dispatch:
types:
- resource-published
- resource-unpublished
jobs:
debug:
runs-on: ubuntu-latest
steps:
- run: |
echo "Status: ${{ github.event.client_payload.status }}"
echo "Path: ${{ github.event.client_payload.path }}"
slack-notification:
if: github.event.client_payload.status == 200 || github.event.client_payload.status == 204
runs-on: ubuntu-latest
steps:
- name: Remove .md extension
id: removeMd
uses: frabert/replace-string-action@v2
with:
pattern: '\.md$'
string: ${{ github.event.client_payload.path }}
replace-with: ''
# the following action is based on a workflow created by Andreas Haller, contact for permissions, the workflow file to import can be found under tools/slack
- name: Notify Slack
uses: slackapi/[email protected]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
with:
payload: |
{
"text": "Just ${{ github.event.client_payload.status == 200 && 'published: https://www.netcentric.biz' || 'unpublished: ' }}${{ endsWith(github.event.client_payload.path, '.json') && github.event.client_payload.path || steps.removeMd.outputs.replaced }}"
}