Skip to content

Commit

Permalink
Create prettier.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
satya-auti authored Jan 8, 2024
1 parent ba3a006 commit b21445f
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Continuous Integration

on:
pull_request:
branches:
- main
jobs:
prettier_check:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: '${{ github.head_ref }}'
persist-credentials: false

- name: Check code formatting
run: |
changed_files=$(git diff --name-only HEAD^)
for file in $changed_files; do
if [[ $file == *.js || $file == *.md ]]; then
prettier_check=$(npx prettier --check $file)
if [[ $? -ne 0 ]]; then
echo "Code formatting required for $file"
exit 1
fi
fi
done

0 comments on commit b21445f

Please sign in to comment.