Skip to content

Commit

Permalink
Use version 7.0 of Azure DevOps API (#1102)
Browse files Browse the repository at this point in the history
The server already uses version 7.0, but the Ruby scripts were lagging.

This is supported from Azure DevOps Server 2022 onwards and by Azure DevOps Services. https://learn.microsoft.com/en-us/azure/devops/integrate/concepts/rest-api-versioning?view=azure-devops#supported-versions

Azure DevOps Server 2022 has been operational since Aug 2022 which is almost 2 years ago.
  • Loading branch information
mburumaxwell authored Apr 23, 2024
1 parent bbd0517 commit 665b035
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions updater/bin/azure_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def pull_requests_active(user_id, default_branch)
response = get(source.api_endpoint +
source.organization + "/" + source.project +
"/_apis/git/repositories/" + source.unscoped_repo +
"/pullrequests?api-version=6.0&searchCriteria.status=active" \
"/pullrequests?api-version=7.0&searchCriteria.status=active" \
"&searchCriteria.creatorId=#{user_id}" \
"&searchCriteria.targetRefName=refs/heads/#{default_branch}")

Expand All @@ -27,7 +27,7 @@ def pull_request_abandon(pull_request_id)
patch(source.api_endpoint +
source.organization + "/" + source.project +
"/_apis/git/repositories/" + source.unscoped_repo +
"/pullrequests/#{pull_request_id}?api-version=6.0", content.to_json)
"/pullrequests/#{pull_request_id}?api-version=7.0", content.to_json)
end

def branch_delete(name)
Expand All @@ -43,7 +43,7 @@ def pull_request_commits(pull_request_id)
response = get(source.api_endpoint +
source.organization + "/" + source.project +
"/_apis/git/repositories/" + source.unscoped_repo +
"/pullrequests/#{pull_request_id}/commits?api-version=6.0")
"/pullrequests/#{pull_request_id}/commits?api-version=7.0")

JSON.parse(response.body).fetch("value")
end
Expand Down Expand Up @@ -71,7 +71,7 @@ def pull_request_approve(pull_request_id, reviewer_token)
put_with_token(source.api_endpoint + source.organization + "/" + source.project +
"/_apis/git/repositories/" + source.unscoped_repo +
"/pullrequests/#{pull_request_id}/reviewers/#{user_id}" \
"?api-version=6.0", content.to_json, reviewer_token)
"?api-version=7.0", content.to_json, reviewer_token)
end

def get_with_token(url, token)
Expand Down

0 comments on commit 665b035

Please sign in to comment.