-
-
Notifications
You must be signed in to change notification settings - Fork 46
52 lines (46 loc) · 1.88 KB
/
validate.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
name: "Validate"
on:
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ] # runs on every push
jobs:
validate:
name: Build and Validate
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v1 # checkout latest commit
- name: Use Node.js ${{ matrix.node-version }} # set up Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Clean install of dependencies # runs the npm ci command to install all dependencies
run: npm ci
env:
CI: "true"
- name: Validate joke files # validates the joke files
run: npm run validate-jokes
env:
CI: "true"
- name: Validate joke IDs # makes sure all jokes have the correct ID
run: npm run validate-ids
env:
CI: "true"
- name: Send Discord success notification # sends a Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: '✅ **JokeAPI CI** (on `{{GITHUB_HEAD_REF}}`) was successful (see https://github.com/{{GITHUB_REPOSITORY}}/actions/runs/{{GITHUB_RUN_ID}})'
if: ${{ github.actor != 'dependabot' }} # don't trigger on dependabot PRs since they don't have access to secrets
- name: Send Discord failure notification # sends a Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: '🚫 **JokeAPI CI** (on `{{GITHUB_HEAD_REF}}`) has failed (see https://github.com/{{GITHUB_REPOSITORY}}/actions/runs/{{GITHUB_RUN_ID}})'
if: ${{ failure() && github.actor != 'dependabot' }} # don't trigger on dependabot PRs since they don't have access to secrets