name: StyleLint

on:
  pull_request:
    branches:
      - '*'
  push:
    branches:
      - master

jobs:
  prettier:
    name: StyleLint Check Action
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Setup Node
      uses: actions/setup-node@v3
      with:
        node-version: '18.x'
    - name: Get yarn cache directory path
      id: yarn-cache-dir-path
      run: echo "::set-output name=dir::$(yarn cache dir)"
    - uses: actions/cache@v1
      id: yarn-cache
      with:
        path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
        key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
        restore-keys: |
          ${{ runner.os }}-yarn-
    - name: Yarn install
      run: yarn
    - name: Run Stylelint Check
      run: yarn stylelint
