Skip to content

Commit

Permalink
fix: error out on failed formatting before error message
Browse files Browse the repository at this point in the history
  • Loading branch information
nl32 committed Apr 24, 2024
1 parent 547ad4c commit 042aad9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/generateCheck.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
if [ $status == 0 ]; then
echo "## Formatting Check passed 🥳" >>$GITHUB_STEP_SUMMARY
echo "All files are formatted correctly" >>$GITHUB_STEP_SUMMARY
exit 0
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
exit 1
fi
4 changes: 2 additions & 2 deletions .github/workflows/prettierCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
- run: npm ci
- name: Prettier check
run: |
files=`npx prettier . -l`
echo status=`echo $?`>>"$GITHUB_ENV"
files=`npx prettier . -l` || st=$?
echo status=`echo $st`>>"$GITHUB_ENV"
echo files=`echo $files`>> "$GITHUB_ENV"
- name: generate github check message
run: .github/workflows/generateCheck.sh

0 comments on commit 042aad9

Please sign in to comment.