diff --git a/.github/workflows/generateCheck.sh b/.github/workflows/generateCheck.sh new file mode 100644 index 00000000..aabe6fc1 --- /dev/null +++ b/.github/workflows/generateCheck.sh @@ -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 diff --git a/.github/workflows/prettierCheck.yml b/.github/workflows/prettierCheck.yml new file mode 100644 index 00000000..494a6a86 --- /dev/null +++ b/.github/workflows/prettierCheck.yml @@ -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