Need to create a Azure DevOps GitHub Artifact programmatically. I'm using .Net Client Libraries and tried the following code.
var artifactMetaData = new ArtifactMetadata { Alias = "ArtiAlias", InstanceReference = new BuildVersion { Id = "32q42324QQe1" } };
The Id I'm refering here is the commit Id of a Git Repo.
I could create Build Artifacts successfully using the above code but it doesn't create GitHub Artifacts.
Was able to check REST API call using Postman and create the ArtifactMetaData
object as same as the REST API object (in request body). Then the problem was solved.
REST API Request Body,
{
"alias": "MyRepo",
"instanceReference": {
"id": "r32283026ewec1c63b0842a58w2aa0a690a58265",
"name": "r3228302",
"sourceBranch": "feature/my-feature-branch",
"commitMessage": "My commit message"
}
}
C# object I created,
var artifactMetadata = new ArtifactMetadata
{
Alias = "MyRepo",
InstanceReference = new BuildVersion
{
Id = "r32283026ewec1c63b0842a58w2aa0a690a58265",
Name = "r3228302",
SourceBranch = "feature/my-feature-branch",
CommitMessage = "My commit message"
}
};,