mkdocstrings-github 0.2.3__tar.gz → 0.2.5__tar.gz

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.
Files changed (106) hide show
  1. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/workflows/qualify.yaml +2 -3
  2. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/workflows/release.yaml +1 -0
  3. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/PKG-INFO +1 -1
  4. mkdocstrings_github-0.2.5/docs/changelog.md +1 -0
  5. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/usage/index.md +4 -3
  6. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/usage/signatures.md +2 -3
  7. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/mkdocs.yml +0 -1
  8. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/pyproject.toml +4 -1
  9. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/config.py +5 -0
  10. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/handler.py +98 -69
  11. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/uv.lock +1 -1
  12. mkdocstrings_github-0.2.3/CHANGELOG.md +0 -1
  13. mkdocstrings_github-0.2.3/docs/changelog.md +0 -1
  14. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/CODEOWNERS +0 -0
  15. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/CONTRIBUTING.md +0 -0
  16. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/FUNDING.yml +0 -0
  17. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/renovate.json5 +0 -0
  18. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/workflows/docs.yaml +0 -0
  19. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.github/workflows/example_workflow.yml +0 -0
  20. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.gitignore +0 -0
  21. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.gitmodules +0 -0
  22. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/.pre-commit-config.yaml +0 -0
  23. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/LICENSE +0 -0
  24. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/README.md +0 -0
  25. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/action.yaml +0 -0
  26. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/contributing.md +0 -0
  27. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/credits.md +0 -0
  28. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/favicon.png +0 -0
  29. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/index.md +0 -0
  30. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/license-page.md +0 -0
  31. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/logo.png +0 -0
  32. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/overrides/main.html +0 -0
  33. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/overrides/partials/toc-item.html +0 -0
  34. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/stylesheets/extra.css +0 -0
  35. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/usage/general.md +0 -0
  36. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/usage/headings.md +0 -0
  37. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/docs/usage/parameters.md +0 -0
  38. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/logo.png +0 -0
  39. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/__init__.py +0 -0
  40. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/objects.py +0 -0
  41. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/py.typed +0 -0
  42. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/rendering.py +0 -0
  43. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/templates/material/action.html.jinja +0 -0
  44. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/templates/material/heading.html.jinja +0 -0
  45. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/templates/material/inputs.html.jinja +0 -0
  46. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/templates/material/outputs.html.jinja +0 -0
  47. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/templates/material/secrets.html.jinja +0 -0
  48. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/templates/material/style.css +0 -0
  49. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/src/mkdocstrings_handlers/github/templates/material/workflow.html.jinja +0 -0
  50. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/__init__.py +0 -0
  51. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/conftest.py +0 -0
  52. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/docs/.gitkeep +0 -0
  53. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/helpers.py +0 -0
  54. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/__init__.py +0 -0
  55. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/.gitignore +0 -0
  56. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/0a37a4286738a72a224871dbd1bcd3c662e768f800a8e2b92c410d672c1d19fc.html +0 -0
  57. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/0c67cdd8572de4a97d061f099552f428affde9f418d962c119559531a92f57aa.html +0 -0
  58. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/0ef4f0725dafdff18802cd0dd8839c35562755c90458f0dd3ef7743e87efdd89.html +0 -0
  59. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/1322d6390dbc167e4d2734b6ff7ac30265a52feb242ece864fd08dd36a88214a.html +0 -0
  60. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/1bb484ae2f4d2bfc6473c265761d6ba4f76c5be5dbd3a9059758e67589f4b320.html +0 -0
  61. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/22929d6c2b70b481583d7b07fd7bff72dba985a465d42ad4ee5a7f557429102f.html +0 -0
  62. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/24dfcb59a486346316de8203f742d4f3dd9129f9a57252c37741ad27d0eaddd7.html +0 -0
  63. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/2500c66e16468b20050dd9b8b152a48644d008c0316e444f47afc7bc5117e004.html +0 -0
  64. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/27b0437dc257c9970044eb25da334453829a4ae0450e98cf7a965aff5ad7fcba.html +0 -0
  65. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/28df0ab9fe5662687b72cbb8b2c8e2e18b98beb5a114a505ad845c91b8955a2e.html +0 -0
  66. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/293f8ca976970a4fb9549b1bd3b6f6be8a13bd86d9c34bb98813def62a5777aa.html +0 -0
  67. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/2eb63f18b2d0aaf8000ffcc081c80067937fc7cacea496c2871198aa3bc12a14.html +0 -0
  68. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/36d5597971381260ce0cd98b6ba1c3973134add32288bf34f47290fdbe55b0ec.html +0 -0
  69. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/37c546e4aceaf4af0a681bdaa444b8be901c78713e762fd96d2237b8a78811c5.html +0 -0
  70. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/3cb099624d882a4cde3ef6fdbea56c9aced9331dca1e19c7bc311c2611782e0d.html +0 -0
  71. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/50af1499553795c8cd859a1c9aa5ba162ef1c3dd9fa466668fc2da5bb002a61c.html +0 -0
  72. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/572198cee6d40e3c875970ee6b4c654b3edae54c5a00ee4792df2b0d5a161796.html +0 -0
  73. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/5a2f11e94bc00c7a5122364dcffcdc9bd5c514a773fbf4d1b04fa7e96ba2cfa5.html +0 -0
  74. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/5f0693318b13614e630f852af6ad9165a3793e2e011d4de786b84e178eb411bc.html +0 -0
  75. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/62440ee595f9a66c9c38e2dd31dd0333a03332893c982993b48c6e8e9074b5be.html +0 -0
  76. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/757b79d7975f29e7b7eeda8c910578cb858a867dc4c647c4b5bc9a4c45dbf62e.html +0 -0
  77. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/78f74a133e98bd757a1bd1c4667dc3a5d7cc40cc78daf596187999cb083ec6c4.html +0 -0
  78. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/78feb92e4171bf067dd1615523e5c9cac0de998bb7102ee70da2e145d1262339.html +0 -0
  79. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/84f918940f7b729b21a97d971a27bf994b2deb8ee5d9909481d98f702dfec96a.html +0 -0
  80. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/856a4ff20ee15b09367d852d57cdb6a3376b799760365dbf7677c216156a7b4d.html +0 -0
  81. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/8df27f9a94e16efe5686ebeded8a93bd5b071f4d39fe47224ce218a6b1e58b90.html +0 -0
  82. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/93bf082d40ca4b6730a503aa4d265901a8cfed7ed1a6e9bb6e584c2c3ebd18af.html +0 -0
  83. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/98e4b6474a6f67576ae40a75e152e6bd8c3e743259ad7f1d08890def2ff858d1.html +0 -0
  84. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/98ed5c777c164326632ca657e3cb87ae3f9b75bf9793ab2db4ab90ee7874621c.html +0 -0
  85. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/a5c25b6859cc07004c872762d51e1c17d597a5d9cf4f325f0d876cafc3096d16.html +0 -0
  86. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/ac47b3b933709154de762d06903d78925cea9f1ec93865386d669680cf17e4a8.html +0 -0
  87. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/b3235de10ed47f4d1a0d1d5fec8deb8323199b703201cc3a525950411079672b.html +0 -0
  88. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/b972a05ffc5672d471d5b1e84b01470a3363a25f9d9adbc8d82f4b9fd21a94a1.html +0 -0
  89. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/bbea0ecf08aec9444ed75cbffd5424aa19e285ac64a53d1bb50f6130230b3c97.html +0 -0
  90. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/c2181f9e06dd6b7437f14e815c4fd32ec304e4474c93e86c02b43f41367a79ff.html +0 -0
  91. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/c50b7f91aafff5caf0fe0ff96a922b499617966705cde0d3622191f51f523b38.html +0 -0
  92. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/c8601796046ec0837b1cc98f777d45532e7c2c36606b8682536e0aac3f678554.html +0 -0
  93. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/c8c895c400f0532aa3afe641f79ed14bc399b504169242c0a9f77572c185def2.html +0 -0
  94. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/cdad9a8909ec6448ff4392f523d4c7d41dcba61fc635e7e744026f901df04913.html +0 -0
  95. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/cdf58c1c57a805ff06487f8361728c09ddf37f7ef3235ad26effab9f1f07f5a4.html +0 -0
  96. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/d0d656ae32436d7b190665f98f3fe2d7a6250ee7ff4e1fb1bcd9a1364d3da2cb.html +0 -0
  97. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/d2e25cb02f371db9bd247a36766f7887ef1d2adad97ba1102ab1d98cf3128dc3.html +0 -0
  98. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/dbb6b804e35c3cf48b6ea556486a82cf6f34af4d7cc455bfc02995969f45d09f.html +0 -0
  99. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/e5a8b4ccf8097faf7e34c1a90377932fad0277a6b89675ef7b9e05fa37fae38c.html +0 -0
  100. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/f0d6c0adbfcc02896663bc47e38910252279cabfe89c8c196c23f02b7d65d77d.html +0 -0
  101. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/f575eacc0b72560cfc4e759f838f4ba8fc6ad1ee88d56fa707a1a840baf3e679.html +0 -0
  102. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/f90542b4e3cbaf7e9820cdad6bbe707e3210983c911f11584cfae580e5cf6a04.html +0 -0
  103. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/snapshots/external/fab6f055074f9b57075eb9f63d7a2f6ce6eb7ae6c5289a675cb24e507f3f5fb5.html +0 -0
  104. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/test_handler.py +0 -0
  105. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/test_render_action.py +0 -0
  106. {mkdocstrings_github-0.2.3 → mkdocstrings_github-0.2.5}/test/test_render_workflow.py +0 -0
@@ -21,7 +21,6 @@ concurrency:
21
21
 
22
22
  jobs:
23
23
  docs:
24
- if: contains(github.event.pull_request.labels.*.name, 'documentation')
25
24
  name: Test deploy documentation
26
25
  uses: ./.github/workflows/docs.yaml
27
26
  concurrency:
@@ -32,9 +31,9 @@ jobs:
32
31
  secrets: inherit
33
32
  with:
34
33
  version: ${{ format('pr-{0}', github.head_ref) || 'test' }}
35
- alias: ""
34
+ alias: "test"
36
35
  set-default: false
37
- push: true
36
+ push: ${{ contains(github.event.pull_request.labels.*.name, 'documentation') }}
38
37
 
39
38
  setup:
40
39
  runs-on: ubuntu-latest
@@ -180,6 +180,7 @@ jobs:
180
180
  continue-on-error: true
181
181
  env:
182
182
  VERSION: ${{ format('pr-{0}', github.head_ref) || 'test' }}
183
+ GH_TOKEN: ${{ github.token }}
183
184
  run: >
184
185
  uv run mike delete
185
186
  --push --ignore-remote-status
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mkdocstrings-github
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: A GitHub Action handler for mkdocstrings
5
5
  Author-email: Mark Hu <watermarkhu@gmail.com>
6
6
  License: MIT
@@ -0,0 +1 @@
1
+ # changelog
@@ -98,7 +98,10 @@ plugins:
98
98
 
99
99
  ### Global-only options
100
100
 
101
- Some options are **global only, and go directly under the handler's name.
101
+ Some options are **global only**, and go directly under the handler's name.
102
+
103
+ ::: mkdocstrings_handlers.github.config.GitHubConfig.hostname
104
+ handler: python
102
105
 
103
106
  ::: mkdocstrings_handlers.github.config.GitHubConfig.repo
104
107
  handler: python
@@ -121,7 +124,6 @@ plugins:
121
124
 
122
125
  ...and locally, overriding the global configuration:
123
126
 
124
-
125
127
  ```markdown title="docs/some_page.md"
126
128
  ::: .github/workflows/reusable-workflow.yml
127
129
  handler: github
@@ -136,7 +138,6 @@ These options affect how the documentation is collected from sources and rendere
136
138
  - [Signature options](./signatures.md): options related to the shown call signature.
137
139
  - [Parameters options](./parameters.md): options related to the input (and output) parameters of the action or workflow.
138
140
 
139
-
140
141
  ::: mkdocstrings_handlers.github.config.GitHubOptions
141
142
  handler: python
142
143
  options:
@@ -14,7 +14,6 @@
14
14
  --8<-- ".github/workflows/example_workflow.yml"
15
15
  ```
16
16
 
17
-
18
17
  ::: mkdocstrings_handlers.github.config.GitHubOptions.show_signature
19
18
  handler: python
20
19
 
@@ -84,9 +83,9 @@
84
83
  mkdocs build
85
84
  ```
86
85
 
87
- !!! info
86
+ !!! info
88
87
 
89
- For GitHub Enterprise instances, you need to additionally set the `GH_HOST` environment variable to your GitHub hostname.
88
+ For GitHub Enterprise instances, you can set either the [`hostname`][mkdocstrings_handlers.github.config.GitHubConfig.hostname] configuration option or the `GH_HOST` environment variable to your GitHub hostname.
90
89
 
91
90
  ??? preview
92
91
 
@@ -120,7 +120,6 @@ plugins:
120
120
  default_handler: github
121
121
  handlers:
122
122
  github:
123
- repo: watermarkhu/mkdocstrings-github
124
123
  options:
125
124
  show_toc_entry: false
126
125
  heading_level: 3
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mkdocstrings-github"
3
- version = "0.2.3"
3
+ version = "0.2.5"
4
4
  description = "A GitHub Action handler for mkdocstrings"
5
5
  authors = [
6
6
  { name = "Mark Hu", email = "watermarkhu@gmail.com" }
@@ -120,6 +120,9 @@ prerelease = false
120
120
  [tool.semantic_release.commit_parser_options]
121
121
  patch_tags = ["fix", "perf", "chore"]
122
122
 
123
+ [tool.semantic_release.changelog]
124
+ changelog_file = "docs/changelog.md"
125
+
123
126
  [tool.pytest.ini_options]
124
127
  pythonpath = [
125
128
  "test"
@@ -171,6 +171,11 @@ class GitHubOptions(BaseModel):
171
171
  class GitHubConfig(BaseModel):
172
172
  """Configuration options for the GitHub handler."""
173
173
 
174
+ hostname: str = Field(
175
+ default="github.com",
176
+ description="The hostname of the GitHub instance to use. This is only needed for GitHub Enterprise installations.",
177
+ )
178
+
174
179
  repo: str = Field(
175
180
  default="",
176
181
  description="""The GitHub repository in the format *owner/repo*.
@@ -74,76 +74,13 @@ class GitHubHandler(BaseHandler):
74
74
  self.major: str = ""
75
75
  self.semver: str = ""
76
76
 
77
- # Only run GitHub releases code if not running under pytest
78
- if (
77
+ # Only run GitHub releases code if required and not in testing
78
+ not_testing = "pytest" not in sys.modules
79
+ no_custom_tags = (
79
80
  rendering.ENV_MAJOR_TAG not in os.environ or rendering.ENV_SEMVER_TAG not in os.environ
80
- ) and "pytest" not in sys.modules:
81
- # Use PyGitHub to find last GitHub releases with tags matching vX.X.X and vX
82
-
83
- GH_HOST = os.environ.get("GH_HOST", "https://api.github.com")
84
-
85
- if (token_key := "GH_TOKEN") in os.environ:
86
- gh = Github(base_url=GH_HOST, auth=Auth.Token(os.environ[token_key]))
87
- elif (token_key := "GITHUB_TOKEN") in os.environ:
88
- gh = Github(base_url=GH_HOST, auth=Auth.Token(os.environ[token_key]))
89
- else:
90
- try:
91
- gh = Github(base_url=GH_HOST, auth=Auth.NetrcAuth())
92
- except RuntimeError:
93
- try:
94
- token = subprocess.check_output(["gh", "auth", "token"], text=True).strip()
95
- if token:
96
- gh = Github(base_url=GH_HOST, auth=Auth.Token(token))
97
- else:
98
- raise RuntimeError("No token from gh auth token")
99
- except Exception:
100
- _logger.warning(
101
- "Could not authenticate with GitHub to get releases. "
102
- "Consider setting .netrc, environment variable GH_TOKEN, "
103
- "or using GitHub CLI (`gh auth login`) to get GitHub releases.",
104
- )
105
- gh = Github(base_url=GH_HOST)
106
-
107
- owner, repo_name = self.config.repo.split("/", 1)
108
- gh_repo = gh.get_repo(f"{owner}/{repo_name}")
109
- releases = list(gh_repo.get_releases())
110
- for release in releases:
111
- tag = release.tag_name
112
- if not self.semver and SEMVER_PATTERN.match(tag):
113
- self.semver = tag
114
- if not self.major and MAJOR_PATTERN.match(tag):
115
- self.major = tag
116
- if self.semver and self.major:
117
- break
118
-
119
- if not self.semver or not self.major:
120
- if not self.semver and not self.major:
121
- messages = ("'vX.X.X' and 'vX'", "'semver and major'")
122
- elif not self.semver:
123
- messages = ("'vX.X.X'", "'semver'")
124
- else: # not self.major
125
- messages = ("'vX'", "'major'")
126
- _logger.warning(
127
- "Could not find suitable GitHub releases for repo '%s'. "
128
- "Make sure there are releases with tags matching %s, "
129
- "if you wish to use option signature_version %s.",
130
- self.config.repo,
131
- messages[0],
132
- messages[1],
133
- )
134
-
135
- if self.config.repo == ".":
136
- url = next(repo.remote("origin").urls)
137
- match = re.search(r"github.com[:/](?P<owner>[^/]+)/(?P<repo>[^/.]+)", url)
138
- if match:
139
- self.config.repo = f"{match.group('owner')}/{match.group('repo')}"
140
- else:
141
- _logger.warning(
142
- "Could not determine GitHub repository automatically from git remote URL '%s'. "
143
- "Make sure the remote URL is a GitHub URL, "
144
- "or set the 'repo' option in the configuration.",
145
- url,
146
- )
81
+ )
82
+ if not_testing and no_custom_tags:
83
+ self.get_releases()
147
84
 
148
85
  # Glob all workflow YAML files using pathlib
149
86
  working_tree_dir = Path(repo.working_tree_dir)
@@ -170,6 +107,98 @@ class GitHubHandler(BaseHandler):
170
107
  if action is not None:
171
108
  self.actions[action_file] = action
172
109
 
110
+ def get_releases(self) -> None:
111
+ gh_host = os.environ.get("GH_HOST", self.config.hostname)
112
+ if gh_host.startswith(("http://", "https://")):
113
+ base_url = gh_host
114
+ elif "/api/" in gh_host:
115
+ # If protocol is missing, default to https
116
+ base_url = f"https://{gh_host}"
117
+ elif gh_host.startswith("api."):
118
+ base_url = f"https://{gh_host}"
119
+ else:
120
+ base_url = f"https://api.{gh_host}"
121
+
122
+ _logger.debug(f"Using GitHub API base URL: {base_url}")
123
+
124
+ if (token_key := "GH_TOKEN") in os.environ:
125
+ gh = Github(base_url=base_url, auth=Auth.Token(os.environ[token_key]))
126
+ _logger.debug(f"Using GitHub authentication from environment variable {token_key}")
127
+ elif (token_key := "GITHUB_TOKEN") in os.environ:
128
+ gh = Github(base_url=base_url, auth=Auth.Token(os.environ[token_key]))
129
+ _logger.debug(f"Using GitHub authentication from environment variable {token_key}")
130
+ else:
131
+ try:
132
+ gh = Github(base_url=base_url, auth=Auth.NetrcAuth())
133
+ _logger.debug("Using GitHub authentication from .netrc")
134
+ except RuntimeError:
135
+ try:
136
+ token = subprocess.check_output(
137
+ ["gh", "auth", "token"], text=True, env=os.environ
138
+ ).strip()
139
+ if token:
140
+ gh = Github(base_url=base_url, auth=Auth.Token(token))
141
+ _logger.debug("Using GitHub authentication from gh cli.")
142
+ else:
143
+ raise RuntimeError("No token from gh auth token")
144
+ except Exception:
145
+ _logger.warning(
146
+ "Could not authenticate with GitHub to get releases. "
147
+ "Consider setting .netrc, environment variable GH_TOKEN, "
148
+ "or using GitHub CLI (`gh auth login`) to get GitHub releases.",
149
+ )
150
+ gh = Github(base_url=base_url)
151
+
152
+ # Determine owner and repo name
153
+ if "/" in self.config.repo:
154
+ owner, repo_name = self.config.repo.split("/", 1)
155
+ else:
156
+ # Try each remote to find a valid GitHub owner/repo
157
+ owner = None
158
+ repo_name = None
159
+ for remote in self.repo.remotes:
160
+ for url in remote.urls:
161
+ match = re.search(
162
+ r"(?P<host>[\w\.-]+)[/:](?P<owner>[^/]+)/(?P<repo>[^/.]+?)(?:\.git)?$",
163
+ url,
164
+ )
165
+ if match:
166
+ owner = match.group("owner")
167
+ repo_name = match.group("repo")
168
+ break
169
+ if owner and repo_name:
170
+ break
171
+ if not (owner and repo_name):
172
+ raise PluginError(
173
+ f"Could not determine GitHub repository owner/name from config.repo='{self.config.repo}' or any git remote URL."
174
+ )
175
+ self.config.repo = f"{owner}/{repo_name}"
176
+
177
+ # Get releases
178
+ gh_repo = gh.get_repo(f"{owner}/{repo_name}")
179
+ releases = list(gh_repo.get_releases())
180
+ for release in releases:
181
+ tag = release.tag_name
182
+ if not self.semver and SEMVER_PATTERN.match(tag):
183
+ self.semver = tag
184
+ if not self.major and MAJOR_PATTERN.match(tag):
185
+ self.major = tag
186
+ if self.semver and self.major:
187
+ break
188
+
189
+ if not self.semver or not self.major:
190
+ if not self.semver and not self.major:
191
+ messages = ("'vX.X.X' and 'vX'", "'semver and major'")
192
+ elif not self.semver:
193
+ messages = ("'vX.X.X'", "'semver'")
194
+ else: # not self.major
195
+ messages = ("'vX'", "'major'")
196
+ _logger.warning(
197
+ f"Could not find suitable GitHub releases for repo '{self.config.repo}'. "
198
+ f"Make sure there are releases with tags matching {messages[0]}, "
199
+ f"if you wish to use option signature_version {messages[1]}.",
200
+ )
201
+
173
202
  def get_options(self, local_options: Mapping[str, Any]) -> HandlerOptions:
174
203
  """Get combined default, global and local options.
175
204
 
@@ -788,7 +788,7 @@ wheels = [
788
788
 
789
789
  [[package]]
790
790
  name = "mkdocstrings-github"
791
- version = "0.2.3"
791
+ version = "0.2.5"
792
792
  source = { editable = "." }
793
793
  dependencies = [
794
794
  { name = "gitpython" },
@@ -1 +0,0 @@
1
- # CHANGELOG
@@ -1 +0,0 @@
1
- --8<-- "CHANGELOG.md"