| package image_repositories |
| "github.com/go-git/go-billy/v5" |
| "github.com/goccy/go-yaml" |
| type PreCommitConfig struct { |
| Repositories []PreCommitRepository `yaml:"repos"` |
| type PreCommitRepository struct { |
| Repository string `yaml:"repo"` |
| Revision string `yaml:"rev"` |
| Hooks []PreCommitHook `yaml:"hooks"` |
| type PreCommitHook struct { |
| Stages []string `yaml:"stages"` |
| func NewPreCommitConfig() *PreCommitConfig { |
| Repositories: []PreCommitRepository{ |
| Repository: "https://github.com/compilerla/conventional-pre-commit", |
| ID: "conventional-pre-commit", |
| Stages: []string{"commit-msg"}, |
| func (c *PreCommitConfig) Write(wr io.Writer) error { |
| bytes, err := yaml.Marshal(c) |
| func (c *PreCommitConfig) WriteFile(fs billy.Filesystem) error { |
| f, err := fs.Create(".pre-commit-config.yaml") |