From 4ad986c7ea31106ce28faaa5b09660ac82feb837 Mon Sep 17 00:00:00 2001 From: nprimo Date: Mon, 17 Apr 2023 16:38:22 +0100 Subject: [PATCH] feat(ga-misc-check-prettier): add github action to check prettier --- .github/workflows/ga-misc-check-prettier.yml | 26 ++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/ga-misc-check-prettier.yml diff --git a/.github/workflows/ga-misc-check-prettier.yml b/.github/workflows/ga-misc-check-prettier.yml new file mode 100644 index 000000000..f1ae7d061 --- /dev/null +++ b/.github/workflows/ga-misc-check-prettier.yml @@ -0,0 +1,26 @@ +name: 'Prettier check' +on: + pull_request: + branches: + - master +jobs: + build: + runs-on: ubuntu-latest + name: Run prettier on changed files + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Get all changed *.md file(s) + id: changed-md + uses: tj-actions/changed-files@v35 + 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}}