File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,26 @@ generate_preview_url() {
1111 local file_path=" $1 "
1212 local pr_id=" $2 "
1313 local path_no_ext=" ${file_path% .* } "
14- local base_url=" http://preview-pr-${pr_id} .paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/"
14+
15+ # Check if file ends with _en (English version)
16+ # _en.rst will only reach English preview, _en.md can be reached in both English and Chinese previews
17+ # To Simplify, we treat all _en files as English version
18+ if [[ " $path_no_ext " == * _en ]]; then
19+ local base_url=" http://preview-pr-${pr_id} .paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/en/"
20+ else
21+ # Use /zh/ path for Chinese version
22+ local base_url=" http://preview-pr-${pr_id} .paddle-docs-preview.paddlepaddle.org.cn/documentation/docs/zh/"
23+ fi
24+
1525 local final_url=" ${base_url}${path_no_ext} .html"
1626 echo " $final_url "
1727}
1828
19- mapfile -t all_git_files < <( git diff --name-only --diff-filter=ACMR develop | sed ' s#^docs/##' )
29+ # Use merge-base to find the common ancestor between PR branch and develop
30+ # This ensures we only get changes from this PR, excluding commits merged to develop after PR creation
31+ BASE_COMMIT=$( git merge-base HEAD develop 2> /dev/null || echo " develop" )
32+
33+ mapfile -t all_git_files < <( git diff --name-only --diff-filter=ACMR " $BASE_COMMIT " | sed ' s#^docs/##' )
2034
2135output_lines=()
2236
You can’t perform that action at this time.
0 commit comments