From 52dca5dc0e60d4d84aa5ecf280a45b24f1111dda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 15 Mar 2025 15:29:01 +0100 Subject: Checkout referenced repos when preparing job --- src/Config.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/Config.hs') diff --git a/src/Config.hs b/src/Config.hs index 68db57d..13be619 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -85,17 +85,18 @@ parseJob name node = flip (withMap "Job") node $ \j -> do jobUses <- maybe (return []) parseUses =<< j .:? "uses" return Job {..} -parseSingleCheckout :: Node Pos -> Parser [ Either JobCheckout ( JobRepo Declared, JobCheckout ) ] +parseSingleCheckout :: Node Pos -> Parser [ Either JobCheckout ( JobRepo Declared, Maybe Text, JobCheckout ) ] parseSingleCheckout = withMap "checkout definition" $ \m -> do - mbName <- m .:? "repo" jcSubtree <- fmap T.unpack <$> m .:? "subtree" jcDestination <- fmap T.unpack <$> m .:? "dest" let checkout = JobCheckout {..} - return $ (: []) $ case mbName of - Nothing -> Left checkout - Just name -> Right ( DeclaredJobRepo (RepoName name), checkout ) + m .:? "repo" >>= \case + Nothing -> return [ Left checkout ] + Just name -> do + revision <- m .:? "revision" + return [ Right ( DeclaredJobRepo (RepoName name), revision, checkout ) ] -parseMultipleCheckouts :: Node Pos -> Parser [ Either JobCheckout ( JobRepo Declared, JobCheckout ) ] +parseMultipleCheckouts :: Node Pos -> Parser [ Either JobCheckout ( JobRepo Declared, Maybe Text, JobCheckout ) ] parseMultipleCheckouts = withSeq "checkout definitions" $ fmap concat . mapM parseSingleCheckout cabalJob :: Node Pos -> Parser [CreateProcess] -- cgit v1.2.3