mkdocstrings-github 0.2.0__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocstrings-github
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: A GitHub Action handler for mkdocstrings
5
5
  Author-email: Mark Hu <watermarkhu@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  mkdocstrings_handlers/github/__init__.py,sha256=0WdFUIq4Xu2ZFtlZNIYCQSoqcx3Ot9Wv41_X_dwbFww,248
2
2
  mkdocstrings_handlers/github/config.py,sha256=pSjA6gU-kC_mXQqNIIGOYEOhtX5VzZDT0H1hRFlGaj8,6089
3
- mkdocstrings_handlers/github/handler.py,sha256=c8s4cQRoWCDRdctiPQI9JtZrCBgITaGVx5puEgbjOvo,9419
3
+ mkdocstrings_handlers/github/handler.py,sha256=uZ_B6ZNnVjJnloJOcYINROHBPYSaBcBKWSFlo4nuARI,9721
4
4
  mkdocstrings_handlers/github/objects.py,sha256=qkRGcwwYCHsrc9JEmujnvIt00_B1y5cR0vGS5NRkuSg,7028
5
5
  mkdocstrings_handlers/github/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  mkdocstrings_handlers/github/rendering.py,sha256=8h5Zn62b3od9Dj3MNvMtAGg_ZyyLfJKv2Z2qGdFaKG8,2329
@@ -11,7 +11,7 @@ mkdocstrings_handlers/github/templates/material/outputs.html.jinja,sha256=ePu1v8
11
11
  mkdocstrings_handlers/github/templates/material/secrets.html.jinja,sha256=92ynVoZinsLEp7_sFS3mL2E2ngOXPPAtXzGAuGFvhmY,2782
12
12
  mkdocstrings_handlers/github/templates/material/style.css,sha256=R2hh1RfHwJ6XNT4YQl_txNkNXcPBZJMCBZn5kQEMQ6M,962
13
13
  mkdocstrings_handlers/github/templates/material/workflow.html.jinja,sha256=E1VUi2w7_NDkpS9VNrWRV52hhyhQvnKUrjPbV_j0Qcg,3312
14
- mkdocstrings_github-0.2.0.dist-info/METADATA,sha256=uMnwLlxvfU-NyryUUY_E2fQLAeX2sQNtxYpBW777McE,3125
15
- mkdocstrings_github-0.2.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
- mkdocstrings_github-0.2.0.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
17
- mkdocstrings_github-0.2.0.dist-info/RECORD,,
14
+ mkdocstrings_github-0.2.2.dist-info/METADATA,sha256=A9BFF_0Cb7Zb2wz_ugJ2jUhtu1660D0BB4vZ-YFL3YE,3125
15
+ mkdocstrings_github-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
16
+ mkdocstrings_github-0.2.2.dist-info/licenses/LICENSE,sha256=5enZtJ4zSp0Ps3jTqFQ4kadcx62BhgTaDNPrXWb3g3E,1069
17
+ mkdocstrings_github-0.2.2.dist-info/RECORD,,
@@ -80,11 +80,17 @@ class GitHubHandler(BaseHandler):
80
80
  ) and "pytest" not in sys.modules:
81
81
  # Use PyGitHub to find last GitHub releases with tags matching vX.X.X and vX
82
82
 
83
- if "GITHUB_TOKEN" in os.environ:
84
- gh = Github(auth=Auth.Token(os.environ["GITHUB_TOKEN"]))
83
+ GH_HOST = os.environ.get("GH_HOST", "https://github.com")
84
+ base_url = f"{GH_HOST}/api/v3"
85
+
86
+ if "GH_TOKEN" in os.environ or "GITHUB_TOKEN" in os.environ:
87
+ gh = Github(
88
+ base_url=base_url,
89
+ auth=Auth.Token(os.environ.get("GH_TOKEN", os.environ.get("GITHUB_TOKEN", ""))),
90
+ )
85
91
  else:
86
92
  try:
87
- gh = Github(auth=Auth.NetrcAuth())
93
+ gh = Github(base_url=base_url, auth=Auth.NetrcAuth())
88
94
  except RuntimeError:
89
95
  try:
90
96
  token = subprocess.check_output(["gh", "auth", "token"], text=True).strip()
@@ -94,8 +100,9 @@ class GitHubHandler(BaseHandler):
94
100
  raise RuntimeError("No token from gh auth token")
95
101
  except Exception:
96
102
  _logger.warning(
97
- "Could not authenticate with GitHub to get releases."
98
- " Consider setting .netrc, environment variable GITHUB_TOKEN, or using GitHub CLI (`gh auth login`) to get GitHub releases.",
103
+ "Could not authenticate with GitHub to get releases. "
104
+ "Consider setting .netrc, environment variable GH_TOKEN, "
105
+ "or using GitHub CLI (`gh auth login`) to get GitHub releases.",
99
106
  )
100
107
  gh = Github()
101
108