Skip to content

Commit 31dea9a

Browse files
committed
ci: quote the prettier markdown glob so all files are checked
The prettier check ran `--check **/*.md` unquoted. With bash globstar off (the default), `**` collapses to a single `*`, so the shell expanded the pattern to one-level-deep paths only: root-level files (ADMINS.md, MAINTAINERS.md, README.md, ...) and files two or more levels deep (cmd/osgen/README.md) were never linted, and formatting drift in them went unnoticed. Quote the glob in both the lint workflow and the lint.markdown Makefile target so prettier expands it internally and matches every .md file at any depth. Also replace a non-ASCII arrow in the Makefile target's output and add its missing help annotation. Signed-off-by: Sean Chittenden <sean.chittenden@crowdstrike.com>
1 parent 35184c7 commit 31dea9a

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ jobs:
3939
- name: Install dependencies
4040
run: npm i -g prettier
4141
- name: Check markdown files
42-
run: prettier --prose-wrap never --print-width 300 --check **/*.md
42+
run: prettier --prose-wrap never --print-width 300 --check "**/*.md"

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ lint.local: ## Run lint locally (not in Docker) across all build-tag combinatio
249249
cd cmd/osgen && golangci-lint run --fix --build-tags $(GOLANGCI_LINT_BUILD_TAGS) --timeout=5m -v ./...
250250

251251
package := "prettier"
252-
lint.markdown:
252+
lint.markdown: ## Check markdown formatting with prettier (same check as CI)
253253
@printf "\033[2m-> Checking node installed...\033[0m\n"
254254
if type node > /dev/null 2>&1 && which node > /dev/null 2>&1 ; then \
255255
node -v; \
@@ -271,16 +271,16 @@ lint.markdown:
271271
echo -e "\033[33m Installing $(package)...\033[0m"; \
272272
npm install -g $(package) --no-shrinkwrap; \
273273
fi
274-
@printf "\033[2m Running markdown lint...\033[0m\n"
275-
if npx $(package) --prose-wrap never --print-width 300 --check **/*.md; [[ $$? -ne 0 ]]; then \
276-
echo -e "\033[32m Found invalid files. Want to auto-format invalid files? (y/n) \033[0m"; \
274+
@printf "\033[2m-> Running markdown lint...\033[0m\n"
275+
if npx $(package) --prose-wrap never --print-width 300 --check "**/*.md"; [[ $$? -ne 0 ]]; then \
276+
echo -e "\033[32m-> Found invalid files. Want to auto-format invalid files? (y/n) \033[0m"; \
277277
read RESP; \
278278
if [ "$$RESP" = "y" ] || [ "$$RESP" = "Y" ]; then \
279279
echo -e "\033[33m Formatting...\033[0m"; \
280-
npx $(package) --prose-wrap never --print-width 300 --write **/*.md; \
280+
npx $(package) --prose-wrap never --print-width 300 --write "**/*.md"; \
281281
echo -e "\033[34m \nAll invalid files are formatted\033[0m"; \
282282
else \
283-
echo -e "\033[33m Unfortunately you are cancelled auto fixing. But we will definitely fix it in the pipeline\033[0m"; \
283+
echo -e "\033[33m Skipping auto-format. CI will flag any remaining issues.\033[0m"; \
284284
fi \
285285
fi
286286

0 commit comments

Comments
 (0)