From ec3a9cb1958f105c0de8cef2e89ec29138518cf0 Mon Sep 17 00:00:00 2001 From: nprimo Date: Tue, 20 Jun 2023 12:09:05 +0100 Subject: [PATCH] feat(ga-misc-check-prettier): simplify ga action - remove creyD/prettier_action marketplace action and replace it with two separate jobs --- .github/workflows/ga-misc-check-prettier.yml | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ga-misc-check-prettier.yml b/.github/workflows/ga-misc-check-prettier.yml index b5bac2dfb..b586d076c 100644 --- a/.github/workflows/ga-misc-check-prettier.yml +++ b/.github/workflows/ga-misc-check-prettier.yml @@ -14,15 +14,15 @@ jobs: - name: 🐧 Checkout uses: actions/checkout@v3 with: - ref: ${{ github.head_ref }} - fetch-depth: 0 + fetch-depth: 2 # OR "2" -> To retrieve the preceding commit. - - name: 💄 Run Prettier - uses: creyD/prettier_action@v4.3 - with: - prettier_options: --write **/*.{js,md,yml,json,sh} - prettier_plugins: 'prettier-plugin-sh' - commit_message: "chore(codebase): format with prettier" - only_changed: True - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Get all changed *.md file(s) + id: changed-md + run: | + echo "changed_files=$(git diff --name-only --merge-base master | grep "\.md$" | xargs)" >> $GITHUB_OUTPUT + + - name: Run step if any *.md file(s) changed + if: steps.changed-md.outputs.changed_files != '' + run: | + npm i -g prettier + npx prettier -c ${{ steps.changed-md.outputs.changed_files }}