-
Notifications
You must be signed in to change notification settings - Fork 11
62 lines (60 loc) · 1.77 KB
/
tests.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
notify-build-start:
# Secrets are not available for forks for security reasons, so pull
# request checks will fail when trying to send the Slack notification.
# Unfortunately, there's no way to explicitly check that a secret is
# available, so we check for event_name instead:
# https://github.com/actions/runner/issues/520
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
steps:
# Send build notifications to Slack
- uses: voxmedia/github-action-slack-notify-build@v1
id: slack
with:
channel_id: C0PT3267R
status: STARTED
color: warning
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 14
- run: yarn install
- run: yarn run lint
- run: yarn run tests
# Send notification on build failure
- name: Notify slack fail
uses: voxmedia/github-action-slack-notify-build@v1
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel_id: C0PT3267R
status: FAILED
color: danger
notify-build-success:
if: ${{ github.event_name == 'push' }}
needs: tests
runs-on: ubuntu-latest
steps:
# Send notification on build success
- name: Notify slack success
uses: voxmedia/github-action-slack-notify-build@v1
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel_id: C0PT3267R
status: SUCCESS
color: good