Slack Notification #210
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Slack Notification | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| # Notify on PRs to master (open / reopen / merge-or-close) but NOT on | |
| # 'synchronize' so pushing new commits to a PR branch is not announced. | |
| types: [ opened, reopened, closed ] | |
| issues: | |
| types: [opened, closed, reopened, edited, deleted, pinned, unpinned, assigned, unassigned, labeled, unlabeled, milestoned, demilestoned] | |
| issue_comment: | |
| types: [created, edited, deleted] | |
| create: | |
| delete: | |
| jobs: | |
| notify_slack: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Send Slack notification | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| uses: 8398a7/action-slack@v3 | |
| with: | |
| status: custom | |
| fields: repo,commit,event,action,workflow,ref,url | |
| custom_payload: | | |
| { | |
| "attachments": [ | |
| { | |
| "color": "${{ job.status }}", | |
| "title": "${{ github.actor }} ${{ github.event.pull_request && github.event.pull_request.merged == true && 'merged a pull request' || github.event.pull_request && 'opened a pull request' || github.event_name == 'push' && 'pushed new changes' || github.event_name == 'create' && 'created a new branch or tag' || github.event_name == 'delete' && 'deleted a branch or tag' || github.event_name == 'issues' && github.event.action || 'triggered an event' }}", | |
| "text": ":tada: Event details:\n\n- Repository: ${{ github.repository }}\n- Branch: ${{ github.ref }}\n- Message: ${{ github.event_name == 'push' && github.event.head_commit.message || github.event_name == 'issues' && github.event.issue.title || github.event_name == 'pull_request' && github.event.pull_request.title || '' }}\n- :globe_with_meridians: Link: ${{ github.event.pull_request.html_url || github.event.issue.html_url || github.event.repository.html_url }}" | |
| } | |
| ] | |
| } | |