chore: Add pull request action #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request | |
on: pull_request | |
jobs: | |
install: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
## This step installs node and sets up several matchers (regex matching for Github Annotations). See | |
## https://github.com/actions/setup-node/blob/25316bbc1f10ac9d8798711f44914b1cf3c4e954/src/main.ts#L58-L65 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
registry-url: https://registry.npmjs.org | |
## The caching steps create a cache key based on the OS and hash of the package-json.lock file. | |
## A cache hit will copy files from Github cache into the `node_modules` folder. | |
## A cache hit will skip the cache steps. | |
- name: Cache node modules | |
id: npm-cache | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-16.x-node-modules-hash-${{ hashFiles('package-lock.json') }} | |
## If `node_modules` has a cache hit, we're going to skip the `npm install` step. | |
- name: Install Packages | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
shell: bash | |
run: npm install --production=false | |
check: | |
runs-on: ubuntu-latest | |
needs: 'install' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Packages | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
shell: bash | |
run: npm install --production=false | |
- name: Lint | |
shell: bash | |
run: npm run lint | |
- name: Type Check | |
shell: bash | |
run: npm run typecheck | |
- name: Run Unit Tests | |
shell: bash | |
run: npm test |