Skip to content

Commit ae901d2

Browse files
author
Tobi Fuhrimann
authored
Merge pull request #23 from lorands/feat-gitlab-api-v4
feat(api): Switch to gitlab api v4
2 parents 65ed6b9 + b832dd7 commit ae901d2

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

scripts/check

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ fi
3939

4040
version_updated_at=0
4141
if [ ! -z "${version_sha}" ]; then
42-
version_updated_at="$(curl -s -H "private-token: ${private_token}" "${protocol}://${gitlab_host}/api/v3/projects/$(urlencode "${project_path}")/repository/commits/${version_sha}" \
42+
version_updated_at="$(curl -s -H "private-token: ${private_token}" "${protocol}://${gitlab_host}/api/v4/projects/$(urlencode "${project_path}")/repository/commits/${version_sha}" \
4343
| jq '.committed_date|.[:19]|strptime("%Y-%m-%dT%H:%M:%S")|mktime')"
4444
fi
4545

46-
open_mrs="$(curl -s -H "private-token: ${private_token}" "${protocol}://${gitlab_host}/api/v3/projects/$(urlencode "${project_path}")/merge_requests?state=opened&order_by=updated_at")"
46+
open_mrs="$(curl -s -H "private-token: ${private_token}" "${protocol}://${gitlab_host}/api/v4/projects/$(urlencode "${project_path}")/merge_requests?state=opened&order_by=updated_at")"
4747
num_mrs="$(echo "${open_mrs}" | jq 'length')"
4848

4949
new_versions=''
@@ -52,7 +52,7 @@ for i in $(seq 0 $((num_mrs - 1))); do
5252
mr="$(echo "${open_mrs}" | jq -r '.['"$i"']')"
5353
mr_sha="$(echo "${mr}" | jq -r '.sha')"
5454
if [ "${mr_sha}" != "null" ]; then
55-
mr_updated_at="$(curl -s -H "private-token: ${private_token}" "${protocol}://${gitlab_host}/api/v3/projects/$(urlencode "${project_path}")/repository/commits/${mr_sha}" \
55+
mr_updated_at="$(curl -s -H "private-token: ${private_token}" "${protocol}://${gitlab_host}/api/v4/projects/$(urlencode "${project_path}")/repository/commits/${mr_sha}" \
5656
| jq '.committed_date|.[:19]|strptime("%Y-%m-%dT%H:%M:%S")|mktime')"
5757
if [ "${mr_updated_at}" -gt "${version_updated_at}" ] || [ -z "${version_sha}" ]; then
5858
new_versions="${new_versions},{\"sha\":\"${mr_sha}\"}"

scripts/out

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ curl \
7070
--header "PRIVATE-TOKEN: ${private_token}" \
7171
--header 'Content-Type: application/json' \
7272
--data "{\"state\":\"${new_status}\",\"name\":\"${build_label}\",\"target_url\":\"${target_url}\"}" \
73-
"${protocol}://${gitlab_host}/api/v3/projects/$(urlencode "${project_path}")/statuses/${commit_sha}"
73+
"${protocol}://${gitlab_host}/api/v4/projects/$(urlencode "${project_path}")/statuses/${commit_sha}"
7474

7575
version="{\"sha\":\"${commit_sha}\"}"
7676

0 commit comments

Comments
 (0)