Repository URL to install this package:
|
Version:
5.2.8.26 ▾
|
name: NotifySlackOnMerge
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- dev-maint3/5.2
- maint/5.2
- dev-wip_feature_multi_backuptarget/6.0
- dev-wip_feature_advanced_scheduler/6.0
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_CHANNEL: "#${{ vars.SLACK_NOTIF_CHANNEL }}" #Defined as repo name-notif in Settings>secrets & variables. Eg. workloadmanager-notif
REPO_OWNER: "trilioData"
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
jobs:
notify-slack:
runs-on: ubuntu-latest
steps:
- name: Generate Timestamp
id: timestamp
run: |
echo "TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_ENV
- name: Send Slack notification
if: github.repository_owner == '${{ env.REPO_OWNER }}''
run: |
echo "PR_MERGED=${{ github.event.pull_request.merged }}"
echo "PR_NUMBER: ${{ github.event.pull_request.number }}"
echo "PR_TITLE: ${{ github.event.pull_request.title }}"
echo "PR_URL: ${{ github.event.pull_request.html_url }}"
echo "TIMESTAMP : ${{ env.TIMESTAMP }}"
curl -X POST -H 'Content-type: application/json' --data '{
"channel": "${{ env.SLACK_CHANNEL }}",
"text": "New GitHub Event",
"blocks": [{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "PR Merged at ${{ env.TIMESTAMP }} ``` PR : ${{ github.event.pull_request.html_url }} \n Branch : ${{ github.ref_name }}```"
}
}]
}' $SLACK_WEBHOOK_URL