From 61356efbb3ef34790e3c4eceefd8f0434c71ca7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Che=C5=82miniak?= Date: Thu, 10 Oct 2024 15:29:26 +0200 Subject: [PATCH] feat: run Prettier on merge to main --- .github/workflows/prettier.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/prettier.yml diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 0000000..90fb825 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,33 @@ +name: Prettier Check on Merge + +on: + push: + branches: + - main + +jobs: + prettier: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Node.js + uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Install dependencies + run: npm ci + + - name: Run Prettier on specific directories + run: npx prettier --write './packages/core/**/*' './packages/cli/**/*' + + - name: Commit changes if any + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Apply Prettier formatting" + git push + continue-on-error: true