summaryrefslogtreecommitdiff
path: root/src/Config.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-03-23 12:40:53 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-03-29 19:16:37 +0100
commitf3dbad3df9f8c9c1aca873d74a34c6f9169133b0 (patch)
tree93d4a0114962c4062f5c6398aeb975a2f64da0e9 /src/Config.hs
parenta372c8cf51bce6179fe0d585a545b7f4f3910233 (diff)
Evaluate canonical job ids
Changelog: Added `jobid` command resolving job reference to canonical id
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 08bc3f2..5631179 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -157,14 +157,14 @@ parseConfig contents = do
Left $ prettyPosWithSource pos contents err
Right conf -> Right conf
-loadConfigForCommit :: MonadIO m => Commit -> m (Either String Config)
-loadConfigForCommit commit = do
- readCommittedFile commit configFileName >>= return . \case
+loadConfigForCommit :: MonadIO m => Tree -> m (Either String Config)
+loadConfigForCommit tree = do
+ readCommittedFile tree configFileName >>= return . \case
Just content -> either (\_ -> Left $ "failed to parse " <> configFileName) Right $ parseConfig content
Nothing -> Left $ configFileName <> " not found"
-loadJobSetForCommit :: MonadIO m => Commit -> m DeclaredJobSet
-loadJobSetForCommit commit = toJobSet <$> loadConfigForCommit commit
+loadJobSetForCommit :: (MonadIO m, MonadFail m) => Commit -> m DeclaredJobSet
+loadJobSetForCommit commit = return . toJobSet =<< loadConfigForCommit =<< getCommitTree commit
where
toJobSet configEither = JobSet
{ jobsetCommit = Just commit