DEVX-121: fix: GiteaClient.set_repo_variable uses PUT instead of PATCH

This commit is contained in:
emil
2026-07-07 15:51:45 +00:00
parent ad7b52c368
commit 6a463a93d2
2 changed files with 8 additions and 7 deletions
+5 -4
View File
@@ -391,15 +391,16 @@ class GiteaClient:
def set_repo_variable(self, name: str, value: str) -> None:
"""Create or update a Gitea Actions repository variable (idempotent).
Tries PATCH first; if the variable doesn't exist (404), creates it
via POST.
Tries PUT first (update); if the variable doesn't exist (404),
creates it via POST. Gitea 1.26.x does not support PATCH for
action variables.
"""
try:
self._request("PATCH", f"/actions/variables/{name}", json={"value": value})
self._request("PUT", f"/actions/variables/{name}", json={"value": value})
except APIError as e:
if e.status != 404:
raise
self._request("POST", "/actions/variables", json={"name": name, "value": value})
self._request("POST", f"/actions/variables/{name}", json={"value": value})
class VikunjaClient: