Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,28 @@ jobs:
merge-multiple: true
digest-mismatch: error

# Fork-only probe. Never print the token or change the PR permissions.
- name: Probe GitHub token access
shell: python
env:
LINKCHECK_PROBE_TOKEN: ${{ github.token }}
run: |
import json
import os
from urllib.request import Request, urlopen

token = os.environ["LINKCHECK_PROBE_TOKEN"]
headers = {"Authorization": f"Bearer {token}", "User-Agent": "pypa-linkcheck-fork-probe"}
with urlopen(Request("https://api.github.com/rate_limit", headers=headers), timeout=20) as response:
limit = int(json.load(response)["resources"]["core"]["limit"])
with urlopen(Request("https://api.github.com/repos/pypa/packaging.python.org", headers=headers), timeout=20) as response:
api_status = response.status
with urlopen(Request("https://github.com/pypa/packaging.python.org", headers=headers), timeout=20) as response:
web_status = response.status
print("TOKEN_PROBE " + json.dumps({"core_limit": limit, "api_status": api_status, "web_status": web_status}), flush=True)
if limit < 1000 or api_status != 200 or web_status != 200:
raise SystemExit("GitHub token is not effective for linkcheck targets")

- *candidate-nox


Expand Down
1 change: 1 addition & 0 deletions _ci_validation/nonce.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
token
3 changes: 3 additions & 0 deletions source/ci_validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,6 @@ Fork CI validation
`Known 98 <http://127.0.0.1:8765/known/98>`_

`Known 99 <http://127.0.0.1:8765/known/99>`_


`New fixture link <http://127.0.0.1:8765/valid>`_
Loading