summaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-11-13 23:23:08 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-11-13 23:23:08 +0100
commit00e5bc0f9874eb9f929e917ba44bbd7b6f2ca4a8 (patch)
treefbfdb065ed90bbbf65dcbe3c41e9042d46ae15cf /src/Config.hs
parentd6ff11543a3897dd2b38ed121f958ef0050e272c (diff)
Do not require recipe and empty checkout in job definition
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Config.hs b/src/Config.hs
index d643f27..22bc89a 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -85,15 +85,18 @@ parseJob :: Text -> Node Pos -> Parser DeclaredJob
parseJob name node = flip (withMap "Job") node $ \j -> do
let jobName = JobName name
jobId = jobName
+ jobRecipe <- choice
+ [ fmap Just $ cabalJob =<< j .: "cabal"
+ , fmap Just $ shellJob =<< j .: "shell"
+ , return Nothing
+ ]
jobCheckout <- choice
[ parseSingleCheckout =<< j .: "checkout"
, parseMultipleCheckouts =<< j .: "checkout"
, withNull "no checkout" (return []) =<< j .: "checkout"
- , return [ JobCheckout Nothing Nothing Nothing ]
- ]
- jobRecipe <- choice
- [ cabalJob =<< j .: "cabal"
- , shellJob =<< j .: "shell"
+ , return $ if isJust jobRecipe
+ then [ JobCheckout Nothing Nothing Nothing ]
+ else []
]
jobArtifacts <- parseArtifacts j
jobUses <- maybe (return []) parseUses =<< j .:? "uses"