blob: e5af38124b2385c9eb6adcb43fbc043914473431 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
module Plugin.GitHubCommit
( gitHubCommit
) where
import Text.Regex.TDFA
import qualified Message as M
import Plugin.Base
gitHubCommit = Plugin
{ matchRegex = "^[0-9a-f]{40}$"
, perform = gitHubCommitAction
}
gitHubCommitAction :: PluginAction
gitHubCommitAction message =
"https://github.com/" ++ M.text message =~ matchRegex gitHubCommit
-- | A type to match the database table for this plugin.
data ChannelRepoUrl = ChannelRepoUrl Int String String deriving (Show)
instance FromRow ChannelRepoUrl where
fromRow = ChannelRepoUrl <$> field <*> field <*> field
|