12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- 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
|