Skip to content

Commit 8051f69

Browse files
committed
Skip RTD workflow on non-documentation changes
1 parent 9c8fbf1 commit 8051f69

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

.readthedocs.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,31 @@ build:
44
os: ubuntu-24.04
55
tools:
66
python: "3.12"
7-
87
commands:
8+
- |
9+
set +e
10+
if git rev-parse --verify -q HEAD^ >/dev/null; then
11+
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD)
12+
else
13+
CHANGED_FILES=""
14+
fi
15+
echo "Changed files: $CHANGED_FILES"
16+
17+
SKIP=1
18+
for f in $CHANGED_FILES; do
19+
case "$f" in
20+
*.po|*.yaml|*.yml)
21+
SKIP=0
22+
;;
23+
esac
24+
done
25+
26+
if [ -n "$CHANGED_FILES" ] && [ "$SKIP" -eq 1 ]; then
27+
echo "No documentation-relevant files changed, skipping build."
28+
exit 183
29+
fi
30+
echo "Continuing build."
31+
exit 0
932
- git clone --depth 1 --branch v3.14.6 https://github.com/python/cpython venv/cpython
1033
- pip install -r venv/cpython/Doc/requirements.txt
1134
- mkdir -p venv/cpython/Doc/locales/fa/LC_MESSAGES
@@ -20,4 +43,4 @@ build:
2043
-D gettext_allow_fuzzy_translations=1
2144
-D html_theme_options.is_rtl=1
2245
venv/cpython/Doc
23-
$READTHEDOCS_OUTPUT/html
46+
$READTHEDOCS_OUTPUT/html

0 commit comments

Comments
 (0)