Skip to content

Commit

Permalink
Added action that forces prettier to be run
Browse files Browse the repository at this point in the history
  • Loading branch information
OhMyGuus committed Dec 25, 2023
1 parent eda9ed7 commit 47fff37
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Prettier

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
prettier:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: npm ci

- name: Run Prettier
run: npm run prettier

- name: Check for changes
id: changes
run: |
git diff --name-only --exit-code HEAD^ HEAD | grep -vE 'package-lock.json'
- name: Fail if changes found
run: |
if [ -n "${{ steps.changes.outputs.stdout }}" ]; then
echo "There are changes after running Prettier. Please run Prettier locally and commit the changes.";
exit 1;
fi

0 comments on commit 47fff37

Please sign in to comment.