Skip to content

Updated workflow

Updated workflow #4

name: Run unit test on pull request
on:
pull_request:
branches: [ 'main' ]
jobs:
run-unit-tests:
name: run-unit-tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16.20.1
- name: Install dependencies
run: npm install
- name: Run unit tests
run: npm test
restrict-merging:
name: restrict-merging
runs-on: ubuntu-latest
needs: run-unit-tests
steps:
- name: Check unit test status
run: |
if [ ${{ needs.run-unit-tests.result }} != 'success' ]; then
exit 1
else
exit 0
fi