Skip to content

Instantly share code, notes, and snippets.

@chrisdone-artificial
Created July 18, 2024 15:31
Show Gist options
  • Save chrisdone-artificial/56654426d4057853f12123162664d98c to your computer and use it in GitHub Desktop.
Save chrisdone-artificial/56654426d4057853f12123162664d98c to your computer and use it in GitHub Desktop.
cc.hell
#!/usr/bin/env hell
-- Check all the prefixes and permitted delimiters against
-- <https://www.conventionalcommits.org/en/v1.0.0/>
main = do
title <- Environment.getEnv "PR_TITLE"
if List.or $
List.map (\prefix ->
List.or [
Text.isPrefixOf (Text.concat [prefix, ": "]) title,
Text.isPrefixOf (Text.concat [prefix, "("]) title,
Text.isPrefixOf (Text.concat [prefix, "!"]) title
])
["fix", "feat", "build", "chore", "ci", "docs", "style",
"refactor", "perf", "test", "BREAKING CHANGE", "revert"]
then Text.putStrLn "Title is OK."
else Error.error "Title is not a conventional commit. See <https://www.conventionalcommits.org/en/v1.0.0/>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment