Skip to content

Commit a92b121

Browse files
committed
If check is run in production it's valid
1 parent b8530da commit a92b121

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

extra/Lamdera/CLI/Check.hs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,23 @@ run :: () -> Lamdera.CLI.Check.Flags -> IO ()
6868
run () flags@(Lamdera.CLI.Check.Flags destructiveMigration) = do
6969
debug_ "Starting check..."
7070

71-
branch <- Lamdera.getGitBranch
72-
case branch of
73-
"main" -> runHelp () flags
74-
"master" -> runHelp () flags
75-
_ -> do
76-
atomicPutStrLn "`lamdera check` is only for main/master branches when preparing for a production deploy."
77-
atomicPutStrLn "If you're trying to deploy a preview app, use `lamdera deploy` instead."
78-
pure ()
71+
inProduction_ <- Lamdera.inProduction
72+
73+
if inProduction_
74+
then
75+
-- In production check will only get run in the right context
76+
-- and we also may not have branch information available due to the checkout mechanism
77+
-- so assume the invocation is right and allow it to continue
78+
runHelp () flags
79+
else do
80+
branch <- Lamdera.getGitBranch
81+
case branch of
82+
"main" -> runHelp () flags
83+
"master" -> runHelp () flags
84+
_ -> do
85+
atomicPutStrLn "`lamdera check` is only for main/master branches when preparing for a production deploy."
86+
atomicPutStrLn "If you're trying to deploy a preview app, use `lamdera deploy` instead."
87+
pure ()
7988

8089

8190
runHelp :: () -> Lamdera.CLI.Check.Flags -> IO ()

0 commit comments

Comments
 (0)