Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🎨 ci: Check Prettier Formatting Drift on Package Changes (#13282)

Danny Avila9799f7e6986d
diff --git a/.github/workflows/eslint-ci.yml b/.github/workflows/eslint-ci.yml
index 629f41662e..f03e88a7a7 100644
--- a/.github/workflows/eslint-ci.yml
+++ b/.github/workflows/eslint-ci.yml
@@ -61,3 +61,30 @@ jobs:
--config eslint.config.mjs \
--max-warnings=0 \
$CHANGED_FILES
+
+ # Run Prettier --check on the same set of changed files to catch
+ # formatting drift in PRs that bypassed the local pre-commit hook
+ # (e.g. GitHub UI edit-and-merge, `git commit --no-verify`).
+ - name: Run Prettier --check on changed files
+ run: |
+ BASE_SHA=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH")
+ CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB "$BASE_SHA" HEAD | grep -E '^(api|client|packages)/.*\.(js|jsx|ts|tsx)$' || true)
+
+ if [[ -z "$CHANGED_FILES" ]]; then
+ echo "No matching files changed. Skipping Prettier."
+ exit 0
+ fi
+
+ echo "Files to check:"
+ echo "$CHANGED_FILES"
+
+ # `prettier --check` exits non-zero if any file would be reformatted.
+ # Suggest the local fix in the failure message so contributors aren't
+ # left guessing how to resolve.
+ if ! npx prettier --check --no-error-on-unmatched-pattern $CHANGED_FILES; then
+ echo ""
+ echo "::error::Prettier formatting drift detected. Fix locally with:"
+ echo "::error:: npx prettier --write <files>"
+ echo "::error::Or rely on the lint-staged pre-commit hook (do not bypass with --no-verify)."
+ exit 1
+ fi