Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions automation/source-repo-templates/api-docs.cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
# TypeScript template.
working-directory: ${{ env.OUTPUT_DIR }}
run: |
find . -type f -name '*.md' -print0 | while IFS= read -r -d '' f; do
find . -type f -name "*.md" -print0 | while IFS= read -r -d '' f; do
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This change correctly silences the linter warning. Since these files serve as source-of-truth templates, consider applying this same quote-style change to the other templates in this directory (e.g., api-docs.python.yml, api-docs.typescript.yml) to ensure consistency. Additionally, ensure these templates configure cancel-in-progress: true for synchronization workflows and include the relative package path in source code links to ensure correct 'View source' resolution in monorepos.

References
  1. For documentation synchronization workflows that force-push to the same branch, set cancel-in-progress: true to prevent race conditions from concurrent runs.
  2. When configuring source code links in documentation generators for monorepos, the base URL must include the relative path to the package directory to ensure 'View source' links resolve correctly.

sed -E -i \
's|\]\(([A-Za-z0-9][^)/]*\.md(#[^)]*)?)\)|](./\1)|g' \
"$f"
Expand All @@ -170,7 +170,7 @@ jobs:
# observable behavior.
working-directory: ${{ env.OUTPUT_DIR }}
run: |
find . -type f -name '*.md' -print0 | while IFS= read -r -d '' f; do
find . -type f -name "*.md" -print0 | while IFS= read -r -d '' f; do
sed -i -E 's/ `inline`//g' "$f"
done

Expand All @@ -182,7 +182,7 @@ jobs:
# delete legitimate cross-references later in the document.
working-directory: ${{ env.OUTPUT_DIR }}
run: |
find . -type f -name '*.md' -print0 | while IFS= read -r -d '' f; do
find . -type f -name "*.md" -print0 | while IFS= read -r -d '' f; do
python3 - "$f" <<'PY'
import pathlib, re, sys
p = pathlib.Path(sys.argv[1])
Expand Down Expand Up @@ -223,7 +223,7 @@ jobs:
# so escape-all is the safer rule here.
working-directory: ${{ env.OUTPUT_DIR }}
run: |
find . -type f -name '*.md' -print0 | while IFS= read -r -d '' f; do
find . -type f -name "*.md" -print0 | while IFS= read -r -d '' f; do
awk '
BEGIN { in_fence = 0 }
/^```/ { in_fence = !in_fence; print; next }
Expand Down Expand Up @@ -334,7 +334,7 @@ jobs:
# extension) so the docs repo can splice them into docs.json.
working-directory: ${{ env.OUTPUT_DIR }}
run: |
find . -name '*.md' -type f \
find . -name "*.md" -type f \
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency with the other find calls in this file, consider placing the -type f filter before the -name glob. Additionally, use -print0 for safer filename handling (ensuring any downstream commands also use -0). Use -maxdepth 2 to ensure the discovery is bounded to the expected directory levels. If these files are being processed for JSX compatibility, ensure the logic ignores curly braces within inline code spans to prevent breaking snippets.

          find . -maxdepth 2 -type f -name "*.md" -print0 \
References
  1. In CI workflows, dynamically discover artifacts (e.g., using 'find' with '-maxdepth 2') instead of hardcoding paths to ensure consistency and prevent failures during upgrades.
  2. When processing Markdown/MDX files to escape curly braces for JSX compatibility, ensure the logic ignores content within inline code spans (backticks) to prevent breaking code snippets.

| sed 's|^\./||; s|\.md$||' \
| sort > _pages.txt
jq -R -s 'split("\n") | map(select(length > 0))' _pages.txt > _pages.json
Expand Down
Loading