42 lines
1.0 KiB
YAML
42 lines
1.0 KiB
YAML
name: Code style
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
prettier:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Get yarn cache directory path
|
|
id: yarn-cache-dir-path
|
|
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
|
|
|
|
- uses: actions/cache@v2
|
|
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: Install packages
|
|
uses: borales/actions-yarn@v2.0.0
|
|
with:
|
|
cmd: --frozen-lockfile
|
|
|
|
- name: Run prettier
|
|
uses: borales/actions-yarn@v2.0.0
|
|
with:
|
|
cmd: format
|
|
|
|
- name: Commit actions
|
|
uses: stefanzweifel/git-auto-commit-action@v4
|
|
with:
|
|
commit_message: Apply Prettier styles
|
|
branch: ${{ github.head_ref }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|