Go-github: Verification missing for commits?

Created on 10 Aug 2017  路  4Comments  路  Source: google/go-github

Hi,

I've looked at the Commit.Verification response returned from ListCommits - it appears to be nil regardless of whether the commit is signed.

For example you could use this one as a tester -
https://github.com/alexellis/faas-cli/pull/30/commits

The commit message etc is brought back correctly - as this is a signed commit with -S this should have Verification in the API.

Please can you advise?

Here's a small code snippet:

    commits, resp, err := client.PullRequests.ListCommits(ctx, req.Repository.Owner.Login, req.Repository.Name, req.PullRequest.Number, listOpts)

    for _, commit := range commits {
        if commit.Commit != nil && commit.Commit.Message != nil {
            fmt.Printf("Commit - %s\n", commit.GetSHA())
            commit.Commit.Verification
            fmt.Println(commit.Commit.Verification)
            if commit.Commit.Verification != nil {
                fmt.Println("Verification element")
                        }
                    }
                }

This would be the URL the API speaks to:

https://api.github.com/repos/alexellis/faas-cli/pulls/30/commits

enhancement

Most helpful comment

@RaviTezu, confirmed:

$ curl -s "https://api.github.com/repos/alexellis/faas-cli/pulls/30/commits" | grep verification
$ curl -s "https://api.github.com/repos/alexellis/faas-cli/pulls/30/commits" -H "Accept: application/vnd.github.cryptographer-preview" | grep verification
      "verification": {

All 4 comments

Hi @alexellis
I just tested this and looks like, the preview header application/vnd.github.cryptographer-preview needs to be set on the request inside the ListCommits method. I will send a PR now.
@shurcooL @gmlewis

@RaviTezu, confirmed:

$ curl -s "https://api.github.com/repos/alexellis/faas-cli/pulls/30/commits" | grep verification
$ curl -s "https://api.github.com/repos/alexellis/faas-cli/pulls/30/commits" -H "Accept: application/vnd.github.cryptographer-preview" | grep verification
      "verification": {

Looking forward to being one of the first people to test this once it's in master 馃憤 - thanks again @RaviTezu @shurcooL

@alexellis Thanks! Let us know if you spot any issues.

Was this page helpful?
0 / 5 - 0 ratings