|
1 | 1 | name: Check notification
|
2 | 2 |
|
3 |
| -on: [pull_request, push] |
| 3 | +on: [push] |
4 | 4 |
|
5 | 5 | jobs:
|
6 |
| - success: |
7 |
| - name: Works properly |
8 |
| - runs-on: ubuntu-18.04 |
| 6 | + notifications: |
| 7 | + name: Rocket.Chat Notifications |
| 8 | + runs-on: ubuntu-latest |
9 | 9 | steps:
|
10 | 10 | - uses: actions/checkout@master
|
11 | 11 |
|
12 |
| - - name: Rocket.Chat Notification |
| 12 | + - name: with mention |
13 | 13 | uses: ./
|
14 |
| - if: always() |
15 | 14 | with:
|
16 | 15 | type: ${{ job.status }}
|
17 | 16 | job_name: ':robot_face: *Success*'
|
18 | 17 | mention: 'here'
|
19 |
| - mention_if: 'failure' |
20 |
| - channel: '#develop' |
21 | 18 | url: ${{ secrets.ROCKETCHAT_WEBHOOK }}
|
22 | 19 |
|
23 |
| - success_no_mention: |
24 |
| - name: Works properly without mention |
25 |
| - runs-on: ubuntu-18.04 |
26 |
| - steps: |
27 |
| - - uses: actions/checkout@master |
28 |
| - |
29 |
| - - name: Rocket.Chat Notification |
| 20 | + - name: with mention on success |
30 | 21 | uses: ./
|
31 |
| - if: always() |
32 | 22 | with:
|
33 | 23 | type: ${{ job.status }}
|
34 |
| - job_name: ':robot_face: *Success no mention*' |
35 |
| - channel: '#develop' |
| 24 | + job_name: ':robot_face: *Success*' |
| 25 | + mention: 'here' |
| 26 | + mention_if: 'success' |
36 | 27 | url: ${{ secrets.ROCKETCHAT_WEBHOOK }}
|
37 | 28 |
|
38 |
| - failure: |
39 |
| - name: Works failed |
40 |
| - runs-on: ubuntu-18.04 |
41 |
| - steps: |
42 |
| - - uses: actions/checkout@master |
43 |
| - |
44 |
| - - name: Forced failure |
45 |
| - run: exit 1 |
46 |
| - |
47 |
| - - name: Rocket.Chat Notification |
| 29 | + - name: with mention on always |
48 | 30 | uses: ./
|
49 |
| - if: failure() |
50 | 31 | with:
|
51 | 32 | type: ${{ job.status }}
|
52 |
| - job_name: ':robot_face: *Failure*' |
| 33 | + job_name: ':robot_face: *Success*' |
53 | 34 | mention: 'here'
|
54 |
| - mention_if: 'failure' |
55 |
| - channel: '#develop' |
| 35 | + mention_if: 'success' |
56 | 36 | url: ${{ secrets.ROCKETCHAT_WEBHOOK }}
|
57 | 37 |
|
58 |
| - - name: Check if work properly |
59 |
| - if: failure() |
60 |
| - run: | |
61 |
| - echo 'Rocket.Chat failure notification succeeded' |
62 |
| - exit 0 |
63 |
| -
|
64 |
| - cancel: |
65 |
| - # You have to cancel this job |
66 |
| - name: Works canceled |
67 |
| - runs-on: ubuntu-18.04 |
68 |
| - needs: success |
69 |
| - timeout-minutes: 1 |
70 |
| - steps: |
71 |
| - - uses: actions/checkout@master |
72 |
| - |
73 |
| - - name: Wait |
74 |
| - run: sleep 70 |
75 |
| - |
76 |
| - - name: Rocket.Chat Notification |
| 38 | + - name: with mention on failure only |
77 | 39 | uses: ./
|
78 |
| - if: cancelled() |
79 | 40 | with:
|
80 | 41 | type: ${{ job.status }}
|
81 |
| - job_name: ':robot_face: *Cancel*' |
| 42 | + job_name: ':robot_face: *Success no mention*' |
82 | 43 | mention: 'here'
|
83 |
| - mention_if: 'always' |
84 |
| - channel: '#develop' |
| 44 | + mention_if: 'failure' |
85 | 45 | url: ${{ secrets.ROCKETCHAT_WEBHOOK }}
|
86 | 46 |
|
87 |
| - - name: Check if work properly |
88 |
| - if: cancelled() |
89 |
| - run: | |
90 |
| - echo 'Rocket.Chat cancelled notification succeeded' |
91 |
| - exit 0 |
92 |
| -
|
93 |
| - commit: |
94 |
| - name: Include commit data |
95 |
| - runs-on: ubuntu-18.04 |
96 |
| - steps: |
97 |
| - - uses: actions/checkout@master |
| 47 | + - name: with no mention |
| 48 | + uses: ./ |
| 49 | + with: |
| 50 | + type: ${{ job.status }} |
| 51 | + job_name: ':robot_face: *Success no mention*' |
| 52 | + url: ${{ secrets.ROCKETCHAT_WEBHOOK }} |
98 | 53 |
|
99 |
| - - uses: ./ |
| 54 | + - name: with commit info |
| 55 | + uses: ./ |
100 | 56 | with:
|
101 | 57 | type: ${{ job.status }}
|
102 | 58 | job_name: ':robot_face: *Commit*'
|
103 |
| - channel: '#develop' |
104 |
| - url: ${{ secrets.ROCKETCHAT_WEBHOOK }} |
105 | 59 | commit: 'true'
|
| 60 | + url: ${{ secrets.ROCKETCHAT_WEBHOOK }} |
106 | 61 | token: ${{ secrets.GITHUB_TOKEN }}
|
0 commit comments