Skip to content

Commit

Permalink
CI Fix rendered doc affected paths for towncrier fragments (#30361)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesteve authored Dec 3, 2024
1 parent 8ded7f4 commit 49199b5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build_tools/circle/build_doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,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" ]
Expand Down

0 comments on commit 49199b5

Please sign in to comment.