From 7badf943850255784115ea866ac6a5261eae5769 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Wed, 24 Dec 2025 20:54:13 -0500 Subject: [PATCH] Try add prettier --- .github/workflows/prettier.yml | 34 ++++++++++++++++++++++++++++++++++ .prettierignore | 1 + .prettierrc | 10 ++++++++++ 3 files changed, 45 insertions(+) create mode 100644 .github/workflows/prettier.yml create mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.github/workflows/prettier.yml b/.github/workflows/prettier.yml new file mode 100644 index 00000000..1164e7c8 --- /dev/null +++ b/.github/workflows/prettier.yml @@ -0,0 +1,34 @@ +name: Prettier Action + +on: + pull_request: + branches: [main] +permissions: + contents: write + +jobs: + prettier: + runs-on: ubuntu-latest + steps: + - name: Checkout + if: github.event.pull_request.head.repo.full_name == 'XTLS/Xray-docs-next' + uses: actions/checkout@v6 + with: + ref: ${{ github.head_ref }} + - name: Checkout + if: github.event.pull_request.head.repo.full_name != 'XTLS/Xray-docs-next' + uses: actions/checkout@v6 + with: + fetch-depth: 2 + - name: Prettify code + if: github.event.pull_request.head.repo.full_name == 'XTLS/Xray-docs-next' + uses: creyD/prettier_action@v4.6 + with: + prettier_options: --write **/*.{js,ts,md,vue} + - name: Prettify code dry run + if: github.event.pull_request.head.repo.full_name != 'XTLS/Xray-docs-next' + uses: creyD/prettier_action@v4.6 + with: + prettier_options: --write **/*.{js,ts,md,vue} + only_changed: true + dry: true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..c2658d7d --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +node_modules/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..247be9a4 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,10 @@ +{ +overrides: [ + { + files: ['**/*.jsonc', '**/*.md'], + options: { + trailingComma: 'none', + } + } +] +} \ No newline at end of file