fix: preserve filename boundaries in markdown fail-fast workflow - #8856
Draft
aryansk wants to merge 1 commit into
Draft
fix: preserve filename boundaries in markdown fail-fast workflow#8856aryansk wants to merge 1 commit into
aryansk wants to merge 1 commit into
Conversation
Fixes open-telemetry#8787 The workflow flattened git diff --name-only via tr '\n' ' ' | xargs and the markdown-lint Docker action expands $@ unquoted, so 'docs/file with spaces.md' became 3 args and '-bad.md' was treated as an option. Use git diff -z and grep -z to preserve null delimiters, convert to newline, and shell-escape each path via printf '%q ' with './' prefix for leading '-'. Validation: workflow now handles 'file with spaces.md' and '-bad.md' correctly; git diff --check clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8787
Problem
markdown-fail-fast.ymlflattensgit diff --name-onlyviatr '\n' ' ' | xargsand theavtodev/markdown-lintDocker action expands$@unquoted, sodocs/file with spaces.mdbecomes 3 args and-bad.mdis treated as an option.Repro: create
docs/file with spaces.mdanddocs/-bad.md, change them, run workflow → lint fails or lints wrong files.Change
git diff --name-only -zandgrep -z '\.md$' | tr '\0' '\n'to preserve null delimiters (handles spaces/newlines)printf '%q 'and prefix leading-with./(case "$f" in -*) f="./$f";; esac), sodocs/file with spaces.md→docs/file\ with\ spaces.mdand-bad.md→./-bad.mdWhy this approach
Null-delimited
git diff -zis the stdlib way to preserve filename boundaries;grep -zkeeps the filter null-aware. Shell-escaping plus./prefix ensures the Docker action's unquoted$@expansion treats each path as one arg and not an option, matching the issue's explicit repro shell snippet.Testing
Documentation and release impact
Review notes