use server infos from config file
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 8s

This commit is contained in:
Thomas Peetz
2026-10-20 18:11:33 +02:00
parent 61683f643a
commit a20eb43889
3 changed files with 16 additions and 14 deletions
+13
View File
@@ -199,6 +199,19 @@ func DeleteData(target config.Server, path, id string) {
}
}
func PushData(target config.Server, path string, data any, result any) (response *resty.Response, err error) {
url := fmt.Sprintf("%s/%s/%s", target.Url, config.Config.ApiVersion, path)
client := resty.New()
token := GetToken(client, target)
response, err = client.R().
SetBody(data).
SetAuthToken(token).
SetHeader("Accept", "application/json").
SetResult(result).
Post(url)
return response, err
}
func UpdateData(target config.Server, path string, v any) {
client := resty.New()
client.SetLoggerWarnLevel(true)