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
7 changes: 6 additions & 1 deletion automation/source-repo-templates/api-docs.cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ jobs:
working-directory: ${{ env.OUTPUT_DIR }}
run: |
find . -type f -name "*.md" -print0 | while IFS= read -r -d '' f; do
# shellcheck disable=SC2016
# Backticks in the sed pattern are literal characters
# matching the markdown code-span delimiters around
# `inline` in moxygen output, not shell command
# substitution. Single quotes are intentional.
sed -i -E 's/ `inline`//g' "$f"
done

Expand Down Expand Up @@ -335,7 +340,7 @@ jobs:
working-directory: ${{ env.OUTPUT_DIR }}
run: |
find . -name "*.md" -type f \
| sed 's|^\./||; s|\.md$||' \
| sed "s|^\./||; s|\.md\$||" \
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

While switching to double quotes silences the ShellCheck SC2016 false positive, using | as a delimiter in sed can be fragile if any generated file paths contain that character. Since find . output always contains /, the pipe delimiter is generally safer than a slash, but if the environment allows for arbitrary filenames, it could still fail. A more robust way to handle the extension stripping while keeping ShellCheck happy would be to use single quotes and a disable comment, or use a different tool like basename or shell parameter expansion. Additionally, ensure that the documentation configuration includes the relative path to the package directory in source code links to ensure they resolve correctly in a monorepo, and consider using find with -maxdepth 2 or explicit project lists to limit discovery scope in CI.

References
  1. 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 to the file locations.
  2. Prefer explicit project lists over automated discovery in CI workflows if the repository structure contains duplicate project configurations.
  3. In CI workflows, dynamically discover build artifacts (e.g., using 'find' with '-maxdepth 2') instead of hardcoding paths to ensure consistency and prevent failures.

| sort > _pages.txt
jq -R -s 'split("\n") | map(select(length > 0))' _pages.txt > _pages.json
rm _pages.txt
Expand Down
Loading