diff --git a/spec/DecodeEventsSpec.hs b/spec/DecodeEventsSpec.hs index 79915ec..e7ea699 100644 --- a/spec/DecodeEventsSpec.hs +++ b/spec/DecodeEventsSpec.hs @@ -5684,6 +5684,9 @@ pushEventFixture = PushEvent , whSimplUserEmail = "baxterthehacker@users.noreply.github.com" , whSimplUserLogin = Just "baxterthehacker" } + , whCommitDistinct = Just True + , whCommitMessage = Just "Update README.md" + , whCommitTimestamp = Just $ read "2015-05-05 23:40:15Z" } ] , evPushHeadCommit = @@ -5707,6 +5710,9 @@ pushEventFixture = PushEvent , whSimplUserEmail = "baxterthehacker@users.noreply.github.com" , whSimplUserLogin = Just "baxterthehacker" } + , whCommitDistinct = Just True + , whCommitMessage = Just "Update README.md" + , whCommitTimestamp = Just $ read "2015-05-05 23:40:15Z" } , evPushRepository = HookRepository @@ -6269,6 +6275,9 @@ statusEventFixture = StatusEvent , whUserType = OwnerUser , whUserIsAdminOfSite = False } + , whCommitDistinct = Nothing + , whCommitMessage = Nothing + , whCommitTimestamp = Nothing } , evStatusCreatedAt = read "2015-05-05 23:40:39Z" , evStatusUpdatedAt = read "2015-05-05 23:40:39Z" diff --git a/src/GitHub/Data/Webhooks/Payload.hs b/src/GitHub/Data/Webhooks/Payload.hs index bcac5aa..288de46 100644 --- a/src/GitHub/Data/Webhooks/Payload.hs +++ b/src/GitHub/Data/Webhooks/Payload.hs @@ -843,6 +843,9 @@ data HookCommit = HookCommit , whCommitCommentsUrl :: !(Maybe URL) -- ^ Not always sent. , whCommitAuthor :: !(Either HookSimpleUser HookUser) , whCommitCommitter :: !(Either HookSimpleUser HookUser) + , whCommitDistinct :: !(Maybe Bool) -- ^ Whether this commit is distinct from any that have been pushed before. Not always sent. + , whCommitMessage :: !(Maybe Text) -- ^ Not always sent + , whCommitTimestamp :: !(Maybe UTCTime) -- ^ Not always sent. } deriving (Eq, Show, Typeable, Data, Generic) @@ -1507,6 +1510,9 @@ instance FromJSON HookCommit where <*> o .:? "comments_url" <*> ((Right <$> o .: "author") <|> (Left <$> o .: "author")) -- try complex form first <*> ((Right <$> o .: "committer") <|> (Left <$> o .: "committer")) -- try complex form first + <*> o .:? "distinct" + <*> o .:? "message" + <*> o .:? "timestamp" instance FromJSON HookRelease where parseJSON = withObject "HookRelease" $ \o -> HookRelease