From 56ab5c7fa38f1cb1c7dc173f183d87213c50bc56 Mon Sep 17 00:00:00 2001 From: Harry <14015057+HarryVasanth@users.noreply.github.com> Date: Mon, 19 Jun 2023 20:46:06 +0100 Subject: [PATCH] feat(workflow): add extended prettier - Use the organization-wide prettier action --- .github/workflows/ga-misc-check-prettier.yml | 38 ++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ga-misc-check-prettier.yml b/.github/workflows/ga-misc-check-prettier.yml index f1ae7d061..b5bac2dfb 100644 --- a/.github/workflows/ga-misc-check-prettier.yml +++ b/.github/workflows/ga-misc-check-prettier.yml @@ -1,26 +1,28 @@ -name: 'Prettier check' +name: 💄 GA-Misc - Check-Prettier + on: pull_request: - branches: - - master + paths-ignore: + - '.github/**' + branches: [master] + jobs: - build: + GA-Misc-Check-Prettier: runs-on: ubuntu-latest - name: Run prettier on changed files + steps: - - uses: actions/checkout@v3 + - name: 🐧 Checkout + uses: actions/checkout@v3 with: - fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + ref: ${{ github.head_ref }} + fetch-depth: 0 - - name: Get all changed *.md file(s) - id: changed-md - uses: tj-actions/changed-files@v35 + - name: 💄 Run Prettier + uses: creyD/prettier_action@v4.3 with: - files: | - **/*.md - - - name: Run step if any *.md file(s) changed - if: steps.changed-md.outputs.any_changed == 'true' - run: | - npm i -g prettier - npx prettier -c ${{steps.changed-md.outputs.all_changed_files}} + 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 }}