-
Notifications
You must be signed in to change notification settings - Fork 7
89 lines (80 loc) · 2.83 KB
/
checks.yml
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Run tests
on: [pull_request]
jobs:
checks:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Cache node modules
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '^18.15.0'
- name: Get deps
run: |
sudo apt-get update
sudo apt-get install -y cracklib-runtime python3-dev libcrack2-dev
npm install
- name: Set env vars
run: |
export NODE_ENV='test'
- name: Run tests
run: |
npm run test
- name: Slack Success Notification
id: slack_success
if: success()
uses: slackapi/slack-github-action@v1.23.0
with:
channel-id: '${{ vars.SLACK_CHANNEL }}'
payload: |
{
"text": "Tests passed for a pull request on ${{ github.repository }}",
"attachments": [
{
"color": "#2EB886",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "PR by @${{ github.triggering_actor }} to merge _${{ github.head_ref }}_ into _${{ github.base_ref }}_ on <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}> passed tests (<${{ github.event.pull_request.html_url }}|View>)"
}
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Slack Failure Notification
id: slack_failure
if: failure()
uses: slackapi/slack-github-action@v1.23.0
with:
channel-id: '${{ vars.SLACK_CHANNEL }}'
payload: |
{
"text": "Tests failed for a pull request on ${{ github.repository }}",
"attachments": [
{
"color": "#A30200",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "PR by @${{ github.triggering_actor }} to merge _${{ github.head_ref }}_ into _${{ github.base_ref }}_ on <${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}> failed tests (<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View>)"
}
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}