From 73a141316db78b942160b11bdb3c92208f3eddd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 19 Jul 2026 15:06:42 +0200 Subject: Push declaration within a job --- src/Config.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Config.hs') diff --git a/src/Config.hs b/src/Config.hs index 40eb1e5..651b05c 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -27,6 +27,7 @@ import System.FilePath.Glob import System.Process import Destination +import Job import Job.Types import Repo @@ -101,6 +102,7 @@ parseJob name node = flip (withMap "Job") node $ \j -> do jobArtifacts <- parseArtifacts j jobUses <- maybe (return []) parseUses =<< j .:? "uses" jobPublish <- maybe (return []) (parsePublish jobName) =<< j .:? "publish" + jobPush <- maybe (return []) parsePush =<< j .:? "push" return Job {..} parseSingleCheckout :: Node Pos -> Parser [ JobCheckout Declared ] @@ -164,6 +166,25 @@ parsePublish ownName = withSeq "Publish list" $ mapM $ jpPath <- fmap T.unpack <$> m .:? "path" return JobPublish {..} +parsePush :: Node Pos -> Parser [ JobPush Declared ] +parsePush = withSeq "Push list" $ mapM $ + withMap "Push specification" $ \m -> do + source <- m .: "source" + jpushSource <- case T.split (== '.') source of + [ repo, sel ] + | sel == "commit" + -> return $ currentCommitExpr (RepoName repo) + _ -> mzero + destination <- m .: "destination" + jpushDestination <- case T.split (== '.') destination of + [ repo, sel ] + | [ fn, bname, fn' ] <- T.split (== '"') sel + , fn == "branch(" + , fn' == ")" + -> return $ branchExpr (RepoName repo) bname + _ -> mzero + return JobPush {..} + parseRepo :: Text -> Node Pos -> Parser DeclaredRepo parseRepo name node = choice -- cgit v1.2.3