danger/swift

Add commit verification metadata to `CommitData`

AvdLee opened this issue · 1 comments

The raw commit data JSON looks as follows:

"commit": {
      "url": "https://api.github.com/repos/octocat/Hello-World/git/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e",
      "author": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      },
      "committer": {
        "name": "Monalisa Octocat",
        "email": "support@github.com",
        "date": "2011-04-14T16:00:49Z"
      },
      "message": "Fix all the bugs",
      "tree": {
        "url": "https://api.github.com/repos/octocat/Hello-World/tree/6dcb09b5b57875f334f61aebed695e2e4193db5e",
        "sha": "6dcb09b5b57875f334f61aebed695e2e4193db5e"
      },
      "comment_count": 0,
      "verification": {
        "verified": false,
        "reason": "unsigned",
        "signature": null,
        "payload": null
      }
    },

However, the verification dictionary is currently not parsed. It should be fairly simple to add by just defining these as a Codable instance. The mocked JSON already contains this data.

Doing so opens up doors to create Danger rules to require signed commits, something that's becoming more and more common in open source repositories.

Where should it be added?

Right here: https://github.com/danger/swift/blob/master/Sources/Danger/GitHubDSL.swift#L374

Resources

More info about the JSON response can be found here: https://docs.github.com/en/rest/commits/commits

Closing because this was implemented on #547