@@ -3,7 +3,7 @@ name: Continuous Integration
3
3
on :
4
4
push :
5
5
branches :
6
- - ' ** '
6
+ - master
7
7
pull_request :
8
8
branches :
9
9
- master
@@ -49,19 +49,57 @@ jobs:
49
49
env :
50
50
NGINX_PLUS_VERSION : nightly
51
51
52
- job-failure :
53
- name : Report Failures
52
+ notify :
53
+ name : Notify
54
54
runs-on : ubuntu-18.04
55
- if : failure()
55
+ needs : build
56
+ if : always() && github.ref == 'refs/heads/master'
56
57
steps :
57
- - name : Slack Notification
58
- uses : rtCamp/action-slack-notify@master
58
+ - name : Workflow Status
59
+ id : check
60
+ uses : martialonline/workflow-status@v1
61
+ - name : Output Variables
62
+ id : commit
63
+ run : |
64
+ echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)"
65
+ echo "::set-output name=repo::$(echo ${GITHUB_REPOSITORY} | cut -d '/' -f 2)"
66
+ - name : Send Notification
67
+ uses : 8398a7/action-slack@v3
68
+ if :
69
+ steps.check.outputs.status == 'failure' ||
70
+ steps.check.outputs.status == 'cancelled'
71
+ with :
72
+ status : custom
73
+ custom_payload : |
74
+ {
75
+ username: 'Github',
76
+ icon_emoji: ':octocat:',
77
+ mention: 'channel',
78
+ attachments: [{
79
+ title: '${{ steps.commit.outputs.repo }} ${{ github.workflow }} pipeline has failed',
80
+ color: '${{ steps.check.outputs.status }}' == 'failure' ? 'danger' : 'warning',
81
+ fields: [{
82
+ title: 'Commit Hash',
83
+ value: '${{ steps.commit.outputs.sha }}',
84
+ short: true
85
+ },
86
+ {
87
+ title: 'Author',
88
+ value: '${{ github.actor }}',
89
+ short: true
90
+ },
91
+ {
92
+ title: 'Commit Message',
93
+ value: `${{ github.event.head_commit.message }}`,
94
+ short: false
95
+ },
96
+ {
97
+ title: 'Pipeline URL',
98
+ value: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}',
99
+ short: false
100
+ }]
101
+ }]
102
+ }
59
103
env :
60
- SLACK_CHANNEL : ${{ secrets.SLACK_CHANNEL }}
61
- SLACK_COLOR : ' #3278BD'
62
- SLACK_ICON_EMOJI : ' :github:'
63
- SLACK_TITLE : Pipeline Failure
64
- SLACK_MESSAGE : ' The pipeline has failed, please check the logs.'
65
- SLACK_FOOTER : ' https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
66
- SLACK_USERNAME : GitHub-Actions
67
- SLACK_WEBHOOK : ${{ secrets.SLACK_HOOK }}
104
+ GITHUB_TOKEN : ${{ github.token }}
105
+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK }}
0 commit comments