Skip to content

Add git workflow.

Add git workflow. #1

Workflow file for this run

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/checkout@v3.1.0
- name: Set up Node.js
uses: actions/setup-node@v3.5.1
with:
node-version: 16
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/cache@v3.0.11
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/cache@v3.0.11
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: yarn install --frozen-lockfile --prefer-offline
- name: Fix Formatting
run: yarn format
- name: Check linting
run: yarn lint
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply formatting changes
branch: ${{ github.head_ref }}