From c84486619d9435e988fbeff2e83c7a4253dd6a4c Mon Sep 17 00:00:00 2001 From: ATS - Elhakim Cool Date: Sat, 21 Dec 2024 04:08:04 +0700 Subject: [PATCH] fix: add automating format after push action --- .github/workflows/node.js.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index d29466b..9686b2d 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -57,3 +57,21 @@ jobs: # Optionally, you can also run linting if set up in Nx - name: Run Lint run: pnpm run lint --if-present + + + # Format the code + - name: Format Code + run: pnpm format + + # Commit and push changes if any files were formatted + - name: Commit and Push Changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + if ! git diff-index --quiet HEAD; then + git commit -m "Auto format code" + git push + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}