Skip to content

Commit

Permalink
chore: formatチェックを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
yukikamome316 committed Mar 24, 2024
1 parent 1557c69 commit 2295de6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
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

0 comments on commit 2295de6

Please sign in to comment.