1
0
Fork 0
mirror of https://github.com/Luzifer/git-changerelease.git synced 2024-12-20 19:11:17 +00:00
git-changerelease/config.go
Knut Ahlers 1a2e6ce639
Add logic to ignore commit messages
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-09-26 10:55:29 +02:00

37 lines
863 B
Go

package main
import (
"errors"
"os"
yaml "gopkg.in/yaml.v2"
)
type configFile struct {
DiableTagSigning bool `yaml:"disable_signed_tags"`
MatchMajor []string `yaml:"match_major"`
MatchPatch []string `yaml:"match_patch"`
ReleaseCommitMessage string `yaml:"release_commit_message"`
IgnoreMessages []string `yaml:"ignore_messages"`
}
func loadConfig() (*configFile, error) {
var err error
if _, err = os.Stat(cfg.ConfigFile); err != nil {
return nil, errors.New("Config file does not exist, use --create-config to create one")
}
c := &configFile{}
if err = yaml.Unmarshal(MustAsset("assets/git_changerelease.yaml"), c); err != nil {
return nil, err
}
dataFile, err := os.Open(cfg.ConfigFile)
if err != nil {
return nil, err
}
defer dataFile.Close()
return c, yaml.NewDecoder(dataFile).Decode(c)
}