mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Query the GH Api authenticated if GITHUB_TOKEN
env variable is available
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
c9c1e2414e
commit
3fe729c471
1 changed files with 6 additions and 1 deletions
|
@ -1305,7 +1305,12 @@ def _get_salt_releases(ctx: Context, repository: str) -> list[Version]:
|
|||
"""
|
||||
versions = set()
|
||||
with ctx.web as web:
|
||||
web.headers.update({"Accept": "application/vnd.github+json"})
|
||||
headers = {
|
||||
"Accept": "application/vnd.github+json",
|
||||
}
|
||||
if "GITHUB_TOKEN" in os.environ:
|
||||
headers["Authorization"] = f"Bearer {os.environ['GITHUB_TOKEN']}"
|
||||
web.headers.update(headers)
|
||||
ret = web.get(f"https://api.github.com/repos/{repository}/tags")
|
||||
if ret.status_code != 200:
|
||||
ctx.error(
|
||||
|
|
Loading…
Add table
Reference in a new issue