Skip to content

Commit e57e238

Browse files
Merge branch 'main' into translation/source
2 parents 9c003e4 + 0a54bb3 commit e57e238

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
name: ${{ matrix.noxenv }}
2525
if: ${{ github.repository_owner == 'pypa' || github.event_name != 'schedule' }}
2626
runs-on: ubuntu-latest
27+
timeout-minutes: 20
2728
strategy:
2829
matrix:
2930
noxenv:
@@ -47,6 +48,9 @@ jobs:
4748
python -m pip install --upgrade nox virtualenv
4849
4950
- name: Nox ${{ matrix.noxenv }}
51+
env:
52+
# Authenticate github.com requests during linkcheck to avoid rate limits.
53+
GITHUB_TOKEN: ${{ github.token }}
5054
run: |
5155
python -m nox -s ${{ matrix.noxenv }}
5256

source/conf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@
161161
# Ref: https://github.com/pypa/packaging.python.org/issues/1998
162162
r"https://blog\.ganssle\.io/.*",
163163
]
164-
linkcheck_retries = 5
164+
linkcheck_retries = 2
165+
linkcheck_timeout = 30
165166
# Ignore anchors for common targets when we know they likely won't be found
166167
linkcheck_anchors_ignore_for_url = [
167168
# GitHub synthesises anchors in JavaScript, so Sphinx can't find them in the HTML
@@ -171,6 +172,13 @@
171172
# https://github.com/pypa/packaging.python.org/issues/1744
172173
r"https://pypi\.org/",
173174
]
175+
# Authenticate requests to github.com (when a token is available) to avoid
176+
# unauthenticated rate limits that can stall linkcheck for hours on CI.
177+
if _gh_token := os.getenv("GITHUB_TOKEN"):
178+
linkcheck_request_headers = {
179+
"https://github.com/": {"Authorization": f"Bearer {_gh_token}"},
180+
"https://api.github.com/": {"Authorization": f"Bearer {_gh_token}"},
181+
}
174182

175183
# -- Options for extlinks ----------------------------------------------------------
176184
# https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html#configuration

0 commit comments

Comments
 (0)