Skip to content

Commit

Permalink
add prettier github action
Browse files Browse the repository at this point in the history
  • Loading branch information
nl32 committed Apr 24, 2024
1 parent b521676 commit 810a9a1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/generateCheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
if [ $status == 0]; then
echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY
echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY
else
echo "## Formatting Check Failed" >>$GITHUB_STEP_SUMMARY
echo "Please run prettier using \`npx prettier . --write\` in order to format your code" >>$GITHUB_STEP_SUMMARY
echo "### Files with bad formatting:" >>$GITHUB_STEP_SUMMARY
for file in $files; do
echo "- $file" >>$GITHUB_STEP_SUMMARY
done
fi
14 changes: 14 additions & 0 deletions .github/workflows/prettierCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Prettier Formatting Check
run-name: Running formatting check
on: [push]
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prettier check
run: |
echo files=`npx prettier . --check`>> "$GITHUB_ENV"
echo status=`echo $?`>>"$GITHUB_ENV"
- name: generate github check message
run: .github/workflows/generateCheck.sh

0 comments on commit 810a9a1

Please sign in to comment.