Skip to content

Commit f82e892

Browse files
authored
Use inline dependency metadata for update-rtd-redirects.py (#13274)
* Use inline dependency metadata for update-rtd-redirects.py * ci: Skip redirect updates if config unchanged
2 parents 873fdf7 + 99601e9 commit f82e892

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.github/workflows/update-rtd-redirects.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Update documentation redirects
33
on:
44
push:
55
branches: [main]
6+
paths:
7+
- ".readthedocs-custom-redirects.yml"
8+
- ".readthedocs.yml"
69
schedule:
710
- cron: 0 0 * * MON # Run every Monday at 00:00 UTC
811

@@ -22,7 +25,6 @@ jobs:
2225
- uses: actions/setup-python@v5
2326
with:
2427
python-version: "3.11"
25-
- run: pip install httpx pyyaml rich
26-
- run: python tools/update-rtd-redirects.py
28+
- run: pipx run tools/update-rtd-redirects.py
2729
env:
2830
RTD_API_TOKEN: ${{ secrets.RTD_API_TOKEN }}

tools/update-rtd-redirects.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Relevant API reference: https://docs.readthedocs.io/en/stable/api/v3.html#redirects
44
"""
55

6+
# /// script
7+
# requires-python = ">=3.11"
8+
# dependencies = ["httpx", "rich", "pyyaml"]
9+
# ///
10+
611
import operator
712
import os
813
import sys

0 commit comments

Comments
 (0)