From 0bc51cf5025caa0eb4252248cabaa661a3cd7a2d Mon Sep 17 00:00:00 2001 From: DevyanshiBansal Date: Tue, 9 Jun 2026 21:54:06 +0530 Subject: [PATCH 1/3] chore: add Prettier formatting validation to frontend PRs --- .github/workflows/prettier-check.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/prettier-check.yml diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml new file mode 100644 index 00000000..757b807b --- /dev/null +++ b/.github/workflows/prettier-check.yml @@ -0,0 +1,23 @@ +name: Prettier Formatting Check + +on: + pull_request: + branches: [ "dev" ] + +jobs: + prettier-validation: + name: Validate Frontend Formatting + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Run Prettier Check + working-directory: ./frontend + run: npx prettier --check "**/*.{ts,tsx,css,md}" \ No newline at end of file From 5f07df73cdb7a2a395ae234d617ed6eec095755e Mon Sep 17 00:00:00 2001 From: DevyanshiBansal Date: Tue, 9 Jun 2026 22:15:31 +0530 Subject: [PATCH 2/3] chore(ci): fix Copilot review warnings for GitHub Action --- .github/workflows/prettier-check.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index 757b807b..a4641854 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -2,7 +2,10 @@ name: Prettier Formatting Check on: pull_request: - branches: [ "dev" ] + branches: [ "dev" ] + +permissions: + contents: read jobs: prettier-validation: @@ -18,6 +21,10 @@ jobs: with: node-version: '20' + - name: Install Dependencies + working-directory: ./frontend + run: npm ci + - name: Run Prettier Check working-directory: ./frontend run: npx prettier --check "**/*.{ts,tsx,css,md}" \ No newline at end of file From 0a41e04717719709e29504f1a15ffd394db3d6c6 Mon Sep 17 00:00:00 2001 From: Devyanshi Bansal Date: Fri, 12 Jun 2026 16:59:28 +0530 Subject: [PATCH 3/3] chore(ci): scope prettier check to changed files --- .github/workflows/prettier-check.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prettier-check.yml b/.github/workflows/prettier-check.yml index a4641854..8c54ec13 100644 --- a/.github/workflows/prettier-check.yml +++ b/.github/workflows/prettier-check.yml @@ -15,6 +15,8 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 @@ -25,6 +27,15 @@ jobs: working-directory: ./frontend run: npm ci - - name: Run Prettier Check - working-directory: ./frontend - run: npx prettier --check "**/*.{ts,tsx,css,md}" \ No newline at end of file + - name: Run Prettier on Changed Files Only + run: | + git fetch origin dev + CHANGED_FILES=$(git diff --name-only origin/dev...HEAD | grep -E '^frontend/.*\.(ts|tsx|css|md)$' || true) + + if [ -z "$CHANGED_FILES" ]; then + echo "No frontend files were modified in this PR. Skipping formatting check." + else + echo "Inspecting the following modified files:" + echo "$CHANGED_FILES" + npx prettier --check $CHANGED_FILES + fi \ No newline at end of file