linting ^ pre-commit #969
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: pre-commit | |
on: | |
push: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
- name: Set up node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
- name: Update npm | |
run: npm install -g npm@latest | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
run: | | |
echo "npm_cache_dir=$(npm config get cache)" >> $GITHUB_ENV | |
- name: Restore NPM cache | |
uses: actions/cache@v3 | |
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ env.npm_cache_dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Restore Gatsby cache | |
uses: actions/cache@v3 | |
id: gatsby-cache | |
with: | |
path: | | |
./.cache | |
./public | |
key: ${{ runner.os }}-gatsby-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-gatsby- | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- uses: pre-commit/action@v3.0.0 |