Skip to content

chore: formatチェックを追加 #1

chore: formatチェックを追加

chore: formatチェックを追加 #1

Workflow file for this run

name: format
on: pull_request
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Restore app cache
uses: actions/cache@v3
id: node_modules_cache_id
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}'
- if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }}
run: npm install
- name: Run format
run: npm run format
- name: Check diff exists
run: |
git add -N .
git diff
line=`git diff | wc -l`
if [ $line -gt 0 ]; then
echo "You need to format before commit"
git diff
exit -1
fi