github-actions 0.1.1.0 → 0.2.0.0
raw patch · 5 files changed
+34/−15 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Language.Github.Actions.Concurrency: Concurrency :: Maybe Text -> Maybe Bool -> Concurrency
+ Language.Github.Actions.Concurrency: Concurrency :: Maybe Text -> Maybe Text -> Concurrency
- Language.Github.Actions.Concurrency: [cancelInProgress] :: Concurrency -> Maybe Bool
+ Language.Github.Actions.Concurrency: [cancelInProgress] :: Concurrency -> Maybe Text
Files
- CHANGELOG.md +9/−0
- github-actions.cabal +6/−6
- src/Language/Github/Actions/Concurrency.hs +17/−6
- test/Language/Github/Actions/WorkflowTest.hs +1/−2
- test/golden/configuration-main.hs.txt +1/−1
CHANGELOG.md view
@@ -1,5 +1,14 @@ # CHANGELOG +## Version 0.2.0 (2025-07-21)++- Changed `cancelInProgress` from `Maybe Bool` to `Maybe Text` to support GitHub Actions expressions+ ## Version 0.1.0 (2025-07-01) Released upon an unsuspecting world++## Version 0.1.1 (2025-07-21)++- Added missing module exports+- Support multiple undocumented input types that work in YAML but were not supported
github-actions.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.2 name: github-actions-version: 0.1.1.0+version: 0.2.0.0 synopsis: Github Actions description: This library provides types and instances for serializing and deserializing@@ -24,7 +24,7 @@ test/golden/configuration-main.hs.txt test/golden/configuration-main.yml -tested-with: GHC ==9.6.6 || ==9.8.2 || ==9.10.1+tested-with: GHC ==9.6.7 || ==9.8.4 || ==9.10.3 || ==9.12.4 common opts default-language: Haskell2010@@ -38,9 +38,9 @@ common deps build-depends: , aeson ^>=2.2.3.0- , base >=4.14 && <4.22+ , base >=4.14 && <4.23 , containers ^>=0.6.7 || ^>=0.7 || ^>=0.8- , hedgehog ^>=1.5+ , hedgehog ^>=1.5 || ^>=1.6 || ^>=1.7 , hoist-error ^>=0.3 , string-interpolate ^>=0.3.3 , text ^>=1.2.4.1 || ^>=2.0.2 || ^>=2.1.1@@ -82,12 +82,12 @@ other-modules: Language.Github.Actions.WorkflowTest build-tool-depends: tasty-discover:tasty-discover ^>=4.2.2 build-depends:- , bytestring ==0.11.5.3 || ==0.12.1.0+ , bytestring ^>=0.11.4.0 || ^>=0.12.0.2 , filepath ^>=1.4 || ^>=1.5 , github-actions , pretty-show ^>=1.10 , tasty ^>=1.5- , tasty-discover ^>=5.0.0+ , tasty-discover ^>=5.0.0 || ^>=5.1.0 || ^>=5.2.0 , tasty-golden ^>=2.3.5 , tasty-golden-extra ^>=0.1.0 , tasty-hedgehog ^>=1.4.0.0
src/Language/Github/Actions/Concurrency.hs view
@@ -27,6 +27,7 @@ import Data.Aeson (FromJSON, ToJSON (..), (.:?), (.=)) import qualified Data.Aeson as Aeson+import Data.Aeson.Types (Parser) import Data.Text (Text) import GHC.Generics (Generic) import Hedgehog (MonadGen)@@ -48,7 +49,7 @@ -- deploymentConcurrency :: Concurrency -- deploymentConcurrency = Concurrency -- { group = Just "${{ github.ref }}"--- , cancelInProgress = Just True+-- , cancelInProgress = Just "true" -- } -- @ --@@ -56,26 +57,36 @@ data Concurrency = Concurrency { -- | Concurrency group identifier group :: Maybe Text,- -- | Whether to cancel in-progress runs- cancelInProgress :: Maybe Bool+ -- | Whether to cancel in-progress runs (can be "true", "false", or an expression)+ cancelInProgress :: Maybe Text } deriving stock (Eq, Generic, Ord, Show) instance FromJSON Concurrency where parseJSON = Aeson.withObject "Concurrency" $ \o -> do group <- o .:? "group"- cancelInProgress <- o .:? "cancel-in-progress"+ mVal <- o .:? "cancel-in-progress" :: Parser (Maybe Aeson.Value)+ cancelInProgress <- case mVal of+ Nothing -> pure Nothing+ Just (Aeson.Bool True) -> pure (Just "true")+ Just (Aeson.Bool False) -> pure (Just "false")+ Just (Aeson.String s) -> pure (Just s)+ Just _ -> fail "cancel-in-progress must be a boolean or string" pure Concurrency {..} instance ToJSON Concurrency where toJSON Concurrency {..} = Aeson.object [ "group" .= group,- "cancel-in-progress" .= cancelInProgress+ "cancel-in-progress" .= fmap cancelInProgressToJSON cancelInProgress ]+ where+ cancelInProgressToJSON "true" = Aeson.Bool True+ cancelInProgressToJSON "false" = Aeson.Bool False+ cancelInProgressToJSON t = Aeson.String t gen :: (MonadGen m) => m Concurrency gen = do group <- Gen.maybe (Gen.text (Range.linear 1 5) Gen.alphaNum)- cancelInProgress <- Gen.maybe Gen.bool+ cancelInProgress <- Gen.maybe (Gen.text (Range.linear 1 5) Gen.alphaNum) pure Concurrency {..}
test/Language/Github/Actions/WorkflowTest.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeApplications #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} @@ -29,7 +28,7 @@ testGroup "Yaml Roundtrip" [ runGoldenVsToYamlFileTest testYamlFilePath- | testYamlFilePath <- testYamlFiles+ | testYamlFilePath <- testYamlFiles ] where runGoldenVsToYamlFileTest testYamlFilePath =
test/golden/configuration-main.hs.txt view
@@ -3,7 +3,7 @@ Just Concurrency { group = Just "${{ github.ref }}"- , cancelInProgress = Just False+ , cancelInProgress = Just "false" } , defaults = Nothing , env = fromList [ ( "SYSTEM_NAME" , "Product Configuration" ) ]