From 234d22fe327ebffa0dc4d65238f673a1657a69a9 Mon Sep 17 00:00:00 2001 From: Jordan Newell <58616955+JordanNewell@users.noreply.github.com> Date: Sat, 28 Nov 2026 10:08:55 -0500 Subject: [PATCH] fix: run prettier from neutral cwd to survive packageManager repos --- .github/workflows/format.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index d15f431..6d9a2d8 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -17,7 +17,15 @@ jobs: with: node-version: 22 + # Run npx from a neutral cwd: repos declaring packageManager (pnpm/bun) + # make npm refuse `npx` from inside the repo (EBADDEVENGINES). + # Prettier config/ignore files are copied to the neutral cwd instead. - name: Check markdown formatting run: | + cd "$RUNNER_TEMP" + mkdir -p prettier-home && cd prettier-home + for f in .prettierrc .prettierrc.json .prettierrc.yml .prettierrc.toml .prettierignore; do + if [ -f "$GITHUB_WORKSPACE/$f" ]; then cp "$GITHUB_WORKSPACE/$f" ./; fi + done [ -f .prettierignore ] || printf 'node_modules/\ndist/\nbuild/\ncoverage/\n.next/\nvendor/\n' > .prettierignore - npx --yes prettier@3.6.2 --check "**/*.md" + npx --yes prettier@3.6.2 --check "$GITHUB_WORKSPACE/**/*.md"