Solution to use Azure DevOps SDK for Git functions - azure-devops

I am searching for a solution where I can use Azure DevOps SDK to view repositories, branch, commit, etc. like a Blazor or other .NET platforms like WinForm.
Before I start mucking with the SDK and create an application using the APIs, for example, I would rather purchase or use a solution that is already out there without re-inventing the wheel.
I would be interested in any solution that someone had already tried or a paid solution.
Thanking you in advance.

I am searching for a solution where I can use Azure DevOps SDK to view repositories, branch, commit
List all repositories via Azure DevOps REST API
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories?api-version=6.1-preview.1
List branch via repo name
GET https://dev.azure.com/{Org name}/{project name}/_apis/git/repositories/{repo name or repo ID}/refs?filter=heads&api-version=6.1-preview.1
Retrieve git commits for a project
GET https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/commits?api-version=6.1-preview.1

Related

Get GitHub commit contributions from commits to Azure DevOps repository

My wish is to have the contributions I make to a repo in Azure DevOps show up on my GitHub profile.
Is there a way to link this up properly?
The email I use for credentials when authenticating towards Azure DevOps is different than my GitHub connected email.
I have tried to use the same credentials for both but to no avail. Maybe I'm missing something.
Hopefully, someone out there has got this working.
Thanks a bunch in advance!
Firstly, you should understand that GitHub and Azure DevOps are independent systems. Azure DevOps has provided some functions e.g REST API,UI function to get repository from GitHub. But It’s a one-way data transfer from GitHub to Azure DevOps.
There is no supported REST API or UI functions that can sync repo changes from to Azure DevOps to your GitHub according DevOps documents at present.
I am afraid that your GitHub contributions graph can’t get credited when you push a change to the Azure DevOps repo.

Delete TFVC Azure Devops Branch API

I'm looking and can't find any TFVC API's, it's all for GIT. I'm needing to delete a branch and then create a new branch from an existing branch in my TFVC repo. Therefore, I'm looking for an API\PowerShell that will accomplish this. I'm wanting an API so that I can add this to my pipeline to perform automatically. PLEASE HELP
Thank you,
There are limited TFVC REST APIs. Branch management is not available via REST.
TFVC is considered feature complete and is not receiving additional investment from Microsoft.
You can use the tf CLI to manage branches, or use the old .NET SOAP client libraries.

How to manage the full Pull Request process in Visual Studio Code with Azure DevOps

I was trying to have a full change from the commit to the pull-request/review process in a Azure DevOps repo with Visual Studio Code.
All good till the point where I have to create a Pull Request.
I didn't find an embedded way to do it.
There is a plugin Pull Requests for Azure Devops but it seems to be not maintained anymore.
Do you know any other good way to do it? Or may be Microsoft can invest in this important feature?
In our team, we started using the Azure CLI but found it too verbose to be practical. We also wanted to have a similar API to the GitHub CLI.
To fix this, we developed doing-cli, which is essentially a wrapper around the Azure CLI with a feel of the GitHub CLI.
A typical workflow for us is:
doing list to see open work items
doing issue create <issue title> to create a new work item
doing pr create <issue number> to create a branch and a PR based on an existing work item
Our company requires that all PRs are linked to a work item. But sometimes you want to fix things quickly, without having to always create a new work item, create a new branch, link them and open a PR. So we implemented doing workon <title> which will do all these steps for you, as well as checkout the newly created branch.
There used to be an extension, but it got pulled.
When you install the azure cli and the devops extension and then create a pull request from the terminal:
az extension add --name azure-devops
az devops configure --defaults organization=https://dev.azure.com/contoso project=ContosoWebApp
az devops pr create --repository MyRepo --open --source-branch branch-name
That last command needs 2 parameters that can be teased out of the context in a repo folder, that way you can easily alias this to a generic command.
Very few people were uring the Azure Repos and PR for Azure DevOps extensions. And most of Microsoft's investments are in GitHub.
As suggested by Jessehouwing's answer, you can create pull requests using Azure CLI.
In addition, you can also use the REST API Pull Requests - Create:
POST https://dev.azure.com/{organization}/{project}/_apis/git/repositories/{repositoryId}/pullrequests?api-version=6.0
Here is an example of the request body:
{
"sourceRefName": "refs/heads/npaulk/my_work",
"targetRefName": "refs/heads/new_feature",
"title": "A new feature",
"description": "Adding a new feature"
}

Kibana Dashboard version control?

I am using Azure DevOps for my source control. I am creating Kibana Dashboard and wondering if it can be source control as well using Azure DevOps. My idea is:
Create Repo in Azure DevOps.
Write automated script(code) so it saves current Kibana Dashboard Saved Object into Azure DevOps.
In this way, I have old Dashboard in the repo. Has anyone done this? It doesn't have to be Azure DevOps, if you have any experience with it, please share with me. I am new to version control.
(https://docs.logz.io/api/cookbook/backing-up-kibana-objects-to-github.html < this was using github)
Kibana Dashboard version control?
The first thing to point out is that Azure devops is not a version control tool. It provides developer services to support teams to plan work, collaborate on code development, and build and deploy applications. Developers can work in the cloud using Azure DevOps Services or on-premises using Azure DevOps Server.
And Azure repo supports two types of version control methods: Git (distributed) and Team Foundation Version Control (TFVC):
What is source control?
You could set the version control type when you create the project:
After that, we could get the URL of the repo is also a git repo:
Git in Visual Studio and Azure DevOps is standard Git, github is the same.
So, that document also applies to azure devops, we just need to replace the github repo link to the azure devops repo link.
In this way, I have old Dashboard in the repo. Has anyone done this?
If you have old Dashboard in the azure devops repo, just clone the old json files to the local and update the json files and push it to the azure devops by git command line. Or you could modify the json files in the azure devops repo UI directly.
So, for the azure devops, you just need to make sure the Version control of your repo is git, and then you can handle azure repo like git.

VSTS-GITHUB Workflow

Please elaborate the steps to create a workflow of Visual
Studio Team Services and Github.
Integration of Github with VSTS and creating a workflow.
Once we create user stories in vsts, is there any way to create a
transition from one state to another(New->Active->resolved),
based on repository update(github).
There is a way to transition from on state to another when github repo is update:
Create a CI build definition for the github repo.
Add a power shell task to change the stories state.
But usually user stories are linked with repo on VSTS not github, that’s more useful and meaningful.
Automatically is only using VSTS git repo.
If you like update this, you need to create a manual integration, possible using the VSTS Rest Api.