From 690a8180fd20c01b069f90738275099b7347395f Mon Sep 17 00:00:00 2001 From: patrick brisbin Date: Thu, 7 Nov 2024 14:36:30 -0500 Subject: [PATCH] Emit disabled status for *all* webhooks :salute: --- src/Restyled/Disabled.hs | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/Restyled/Disabled.hs b/src/Restyled/Disabled.hs index 6077162b..7b0d7785 100644 --- a/src/Restyled/Disabled.hs +++ b/src/Restyled/Disabled.hs @@ -60,28 +60,12 @@ newtype Owner = Owner deriving stock (Generic) deriving anyclass (FromJSON, ToJSON) --- | Decide if we should emit a disabled status intead of processing --- --- Rough plan: --- --- - [x] Our own testing repositories --- - [x] All public repositories --- - [ ] All except those orgs who are still paying --- - [ ] Every -shouldEmitDisabledStatus :: Webhook -> Bool -shouldEmitDisabledStatus webhook - | webhook.pull_request.base.repo.owner.login == "restyled-io" = True - | not webhook.pull_request.base.repo.private = True - | otherwise = False - emitDisabledStatus :: (MonadIO m, MonadLogger m, MonadReader env m, HasSettings env) => BSL.ByteString -> m (Either String GitHub.Status) emitDisabledStatus body = runExceptT $ do webhook <- hoistEither $ eitherDecode body - guard $ shouldEmitDisabledStatus webhook - settings <- lift $ view settingsL token <- generateToken settings webhook @@ -140,5 +124,5 @@ createStatus token webhook = docs :: Text docs = "https://docs.restyled.io/docs/migrating-to-github-actions/" -unTry :: (MonadError String m, Show e) => m (Either e a) -> m a -unTry f = either (throwError . show) pure =<< f +unTry :: (MonadError String m, Exception e) => m (Either e a) -> m a +unTry f = either (throwError . displayException) pure =<< f