Merge pull request #8 from SweetmanTech/sweets/optimism #24
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: Lint | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
- test | |
jobs: | |
run-linters: | |
name: Run linters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
uses: actions/[email protected] | |
- name: Set up Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
registry-url: "https://npm.pkg.github.com" | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache yarn cache | |
uses: actions/[email protected] | |
id: cache-yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-dev-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-dev- | |
- name: Cache node_modules | |
id: cache-node-modules | |
uses: actions/[email protected] | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-dev-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-dev- | |
- name: Install Dependencies | |
run: npm install --frozen-lockfile --prefer-offline | |
- name: Fix Formatting | |
run: yarn format | |
- name: Check linting | |
run: yarn run lint && yarn run build | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Apply formatting changes | |
branch: ${{ github.head_ref }} |