Browse Source

feat(workflow): add extended prettier

- Use the organization-wide prettier action
pull/1513/head
Harry 1 year ago committed by Niccolò Primo
parent
commit
56ab5c7fa3
  1. 38
      .github/workflows/ga-misc-check-prettier.yml

38
.github/workflows/ga-misc-check-prettier.yml

@ -1,26 +1,28 @@
name: 'Prettier check' name: 💄 GA-Misc - Check-Prettier
on: on:
pull_request: pull_request:
branches: paths-ignore:
- master - '.github/**'
branches: [master]
jobs: jobs:
build: GA-Misc-Check-Prettier:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Run prettier on changed files
steps: steps:
- uses: actions/checkout@v3 - name: 🐧 Checkout
uses: actions/checkout@v3
with: 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) - name: 💄 Run Prettier
id: changed-md uses: creyD/prettier_action@v4.3
uses: tj-actions/changed-files@v35
with: with:
files: | prettier_options: --write **/*.{js,md,yml,json,sh}
**/*.md prettier_plugins: 'prettier-plugin-sh'
commit_message: "chore(codebase): format with prettier"
- name: Run step if any *.md file(s) changed only_changed: True
if: steps.changed-md.outputs.any_changed == 'true' env:
run: | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm i -g prettier
npx prettier -c ${{steps.changed-md.outputs.all_changed_files}}

Loading…
Cancel
Save