Skip to content

Commit a25cc56

Browse files
committed
feat (docs): allow to list more tags for github
1 parent 9a26fee commit a25cc56

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

docs/diracdoctools/scripts/dirac-docs-get-release-notes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ def gitlabSetup(GITLABTOKEN=""):
9292
SESSION.headers.update({"PRIVATE-TOKEN": GITLABTOKEN})
9393

9494

95-
def req2Json(url, parameterDict=None, requestType="GET"):
95+
def req2Json(url, parameterDict=None, requestType="GET", queryParameters=None):
9696
"""Call to github API using requests package."""
9797
log = LOGGER.getChild("Requests")
9898
log.debug("Running %s with %s ", requestType, parameterDict)
99-
req = getattr(SESSION, requestType.lower())(url, json=parameterDict)
99+
req = getattr(SESSION, requestType.lower())(url, json=parameterDict, params=queryParameters)
100100
if req.status_code not in (200, 201):
101101
log.error("Unable to access API: %s", req.text)
102102
raise RuntimeError("Failed to access API")
@@ -433,7 +433,7 @@ def parseOptions(self):
433433
for var, val in sorted(vars(parsed).items()):
434434
log.info("Using options: %s = %s", var, pformat(val))
435435

436-
def _github(self, action):
436+
def _github(self, action, per_page=None):
437437
"""Return the url to perform actions on github.
438438
439439
:param str action: command to use in the gitlab API, see documentation there
@@ -442,6 +442,7 @@ def _github(self, action):
442442
log = LOGGER.getChild("GitHub")
443443
options = dict(self._options)
444444
options["action"] = action
445+
445446
ghURL = f"https://api.github.com/repos/{options['owner']}/{options['repo']}/{options['action']}"
446447
log.debug("Calling: %s", ghURL)
447448
return ghURL
@@ -504,7 +505,7 @@ def getGithubLatestTagDate(self, sinceTag):
504505
log = LOGGER.getChild("getGithubLatestTagDate")
505506

506507
# Get all tags
507-
tags = req2Json(url=self._github("tags"))
508+
tags = req2Json(url=self._github("tags"), queryParameters={"per_page": 100})
508509
if isinstance(tags, dict) and "Not Found" in tags.get("message"):
509510
raise RuntimeError(f"Package not found: {str(self)}")
510511

0 commit comments

Comments
 (0)