Skip to content

Fredkiss3/fe 99 enforce code formatting #3

Fredkiss3/fe 99 enforce code formatting

Fredkiss3/fe 99 enforce code formatting #3

Workflow file for this run

name: Prettier Check
on:
pull_request:
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v3
with:
node-version: "20.x"
- run: npm ci
- name: Check formatting
id: check_format
run: |
npm run format -- --check || STATUS=$? || true
echo "FORMAT_STATUS=$STATUS" >> $GITHUB_OUTPUT
- name: Evaluate formatting
if: always() # Ensures this step always runs, regardless of the previous step's status.
run: |
if [ $FORMAT_STATUS -ne 0 ]; then
echo '❌ Changes not properly formatted, did you forget to run `npm run format` ?' >> $GITHUB_STEP_SUMMARY
exit 1
else
echo 'βœ… Changes are properly formatted.' >> $GITHUB_STEP_SUMMARY
fi