1

I am creating Release using the github's octokit API. Create release method creates release and also create corresponding tag.

I also want to create additional tag. So using the example here i am trying to create a tag. I am assuming when GitHubClient creates release it has to commit changes as well. However i am not sure how do get SHA of the release commit so that i can use that SHA to create additional tag?

Here is my current code:

var client = new GitHubClient(new ProductHeaderValue(Constants.ProductHeader));
var tokenAuth = new Credentials(options.AccessToken);
client.Credentials = tokenAuth;

var newRelease = new NewRelease(options.Version)
{
    Name = options.Version,
    Body = "This is test release",
    Draft = false,
    Prerelease = false
};            

var result = await client.Repository.Release.Create(Constants.Owner, repositoryName, newRelease);

??? How do i get `sha` here for the release 

var tag = "AdditionalTag"

var newTag = new NewTag()
{
    Message = tag,
    Tag = tag,
    Type = TaggedType.Tag,
    Object = ???
};

await client.Git.Tag.Create(Constants.Owner, repositoryName, newTag);

This throws the exception "Validation Failed", because I am not setting the SHA.

Questions

  1. How do I calculate the SHA of the git object?

  2. The octokit also has TagsClient class. What is the difference between TagsClient and GitHubClient?

LP13
  • 30,567
  • 53
  • 217
  • 400

0 Answers0