From 3bdf9dc4978de6e6a9c8d722538d77a463f43711 Mon Sep 17 00:00:00 2001 From: iphydf Date: Tue, 15 Feb 2022 00:01:55 +0000 Subject: [PATCH] fix: Sometimes the commit user isn't set in check_suite events. Ridiculous. --- .github/workflows/ci.yml | 3 +++ src/GitHub/Types/Base/Commit.hs | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 396d0e1..d3a7876 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,3 +7,6 @@ on: jobs: build: uses: TokTok/ci-tools/.github/workflows/haskell-ci.yml@master + + common: + uses: TokTok/ci-tools/.github/workflows/common-ci.yml@master diff --git a/src/GitHub/Types/Base/Commit.hs b/src/GitHub/Types/Base/Commit.hs index 6108714..c7b2bd5 100644 --- a/src/GitHub/Types/Base/Commit.hs +++ b/src/GitHub/Types/Base/Commit.hs @@ -5,7 +5,7 @@ module GitHub.Types.Base.Commit where import Data.Aeson (FromJSON (..), ToJSON (..), object) -import Data.Aeson.Types (Value (..), (.:), (.=)) +import Data.Aeson.Types (Value (..), (.:), (.:?), (.=)) import Data.Text (Text) import Test.QuickCheck.Arbitrary (Arbitrary (..)) @@ -17,7 +17,7 @@ import GitHub.Types.Base.User data Commit = Commit { commitSha :: Text - , commitUser :: User + , commitUser :: Maybe User , commitRepo :: Maybe Repository , commitLabel :: Text , commitRef :: Text @@ -27,7 +27,7 @@ data Commit = Commit instance FromJSON Commit where parseJSON (Object x) = Commit <$> x .: "sha" - <*> x .: "user" + <*> x .:? "user" <*> x .: "repo" <*> x .: "label" <*> x .: "ref"