diff --git a/build_tools/circle/build_doc.sh b/build_tools/circle/build_doc.sh index 30a0d3fc8a9b5..2ff0e55b31d55 100755 --- a/build_tools/circle/build_doc.sh +++ b/build_tools/circle/build_doc.sh @@ -209,9 +209,16 @@ cd - set +o pipefail affected_doc_paths() { + scikit_learn_version=$(python -c 'import re; import sklearn; print(re.sub(r"(\d+\.\d+).+", r"\1", sklearn.__version__))') files=$(git diff --name-only origin/main...$CIRCLE_SHA1) # use sed to replace files ending by .rst or .rst.template by .html - echo "$files" | grep ^doc/.*\.rst | sed 's/^doc\/\(.*\)\.rst$/\1.html/; s/^doc\/\(.*\)\.rst\.template$/\1.html/' + echo "$files" | grep -vP 'upcoming_changes/.*/\d+.*\.rst' | grep ^doc/.*\.rst | \ + sed 's/^doc\/\(.*\)\.rst$/\1.html/; s/^doc\/\(.*\)\.rst\.template$/\1.html/' + # replace towncrier fragment files by link to changelog. uniq is used + # because in some edge cases multiple fragments can be added and we want a + # single link to the changelog. + echo "$files" | grep -P 'upcoming_changes/.*/\d+.*\.rst' | sed "s@.*@whats_new/v${scikit_learn_version}.html@" | uniq + echo "$files" | grep ^examples/.*.py | sed 's/^\(.*\)\.py$/auto_\1.html/' sklearn_files=$(echo "$files" | grep '^sklearn/') if [ -n "$sklearn_files" ]