From f194553cc74f09d2243710f769acc30314834cc3 Mon Sep 17 00:00:00 2001 From: vansh2408 Date: Sat, 11 Oct 2025 16:42:58 +0530 Subject: [PATCH] fix: enable Prettier GitHub Action to auto-commit formatting changes --- .github/workflows/prettier.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml index 4d965dc..2ce940b 100644 --- a/.github/workflows/prettier.yml +++ b/.github/workflows/prettier.yml @@ -6,6 +6,10 @@ on: push: branches: [master, main] +permissions: + contents: write + pull-requests: write + jobs: prettier-format: runs-on: ubuntu-latest @@ -15,6 +19,7 @@ jobs: uses: actions/checkout@v4 with: # Checkout with token to allow pushing changes + ref: ${{ github.head_ref || github.ref }} token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 @@ -51,7 +56,8 @@ jobs: git config --local user.name "GitHub Action" git add . git commit -m "🧹 Auto-format code with Prettier [skip ci]" - git push + git push origin HEAD:${{ github.head_ref || github.ref_name }} + echo "Changes pushed successfully!" - name: Comment on PR with success message if: github.event_name == 'pull_request' && steps.verify-changed-files.outputs.changed == 'true'