test: version updater add gitlab_api function

Signed-off-by: anviar <oleg.kluchkin+github@gmail.com>
This commit is contained in:
anviar 2024-02-28 10:42:01 +03:00
parent 51c5b7e4a4
commit ec522a0a3e
No known key found for this signature in database
GPG key ID: 1D9496B16B0FC606

View file

@ -39,6 +39,13 @@ github_api() {
curl --retry 5 --silent --fail -u "${GIT_USER}:${GITHUB_TOKEN}" "${url}" "$@"
}
gitlab_api() {
local url
url="https://gitlab.com/api/v4/${1}"
shift 1
curl --retry 5 --silent --fail "${url}" "$@"
}
post_pull_request() {
local pr_title="$1"
local default_branch="$2"
@ -73,7 +80,7 @@ then
version="$(github_api "repos/${source_repo}/releases/latest" | jq '.tag_name' | tr -d '"v')"
elif [[ "${type}" == "gitlab" ]]
then
version="$(curl --retry 5 --silent --fail "https://gitlab.com/api/v4/projects/${source_repo}/releases"|jq '.[0].tag_name'| tr -d '"v')"
version="$(gitlab_api "projects/${source_repo}/releases" | jq '.[0].tag_name' | tr -d '"v')"
else
echo_red 'Unknown source type. Terminating.'
exit 128