diff --git a/.github/labeler.yml b/.github/labeler.yml index 3a60ece..cab3ae8 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -2,28 +2,29 @@ # Below this line, the keys are labels to be applied, and the values are the file globs to match against. # Anything in the `design` directory gets the `Design` label. design: - - design/* + - changed-files: + - any-glob-to-any-file: design/* example: - - example/* - - examples/* + - changed-files: + - any-glob-to-any-file: ["example/*", "examples/*"] documentation: - - docs/**/* - - README.md + - changed-files: + - any-glob-to-any-file: ["docs/**/*", "README.md"] dependencies: - - go.mod - - go.sum + - changed-files: + - any-glob-to-any-file: ["go.mod", "go.sum"] hack: - - hack/* + - changed-files: + - any-glob-to-any-file: hack/* unit-tests: - - "pkg/**/*_test.go" - - "cmd/**/*_test.go" - - "config/**/*_test.go" - - "internal/**/*_test.go" + - changed-files: + - any-glob-to-any-file: ["pkg/**/*_test.go", "cmd/**/*_test.go", "config/**/*_test.go", "internal/**/*_test.go"] e2e-tests: - - "test/e2e/**/*" + - changed-files: + - any-glob-to-any-file: test/e2e/**/* \ No newline at end of file diff --git a/.github/workflows/autolabel.yaml b/.github/workflows/autolabel.yaml index 9a95311..d9c87bb 100644 --- a/.github/workflows/autolabel.yaml +++ b/.github/workflows/autolabel.yaml @@ -1,4 +1,4 @@ -name: "Auto Label" +name: "auto label" # pull_request_target means that this will run on pull requests, but in the context of the base repo. # This should mean PRs from forks are supported. # Because it includes the `synchronize` parameter, any push of a new commit to the HEAD ref of a pull request diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml deleted file mode 100644 index 8b13789..0000000 --- a/.github/workflows/e2e.yaml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index e1cd019..e4e6b01 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,8 +1,6 @@ name: golangci-lint on: push: - tags: - - v* branches: - main paths-ignore: @@ -19,7 +17,7 @@ jobs: golangci: strategy: matrix: - go: [ '1.20', '1.21', '1.22'' ] + go: [ '1.20', '1.21', '1.22' ] os: [ ubuntu-latest, windows-latest ] permissions: contents: read # for actions/checkout to fetch code diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 6b1dc7b..0633dcb 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,8 +1,8 @@ name: "Release a version" - on: - tags: - - 'v*' + push: + tags: + - 'v*' permissions: contents: write jobs: diff --git a/cmd/cz/cz.go b/cmd/cz/cz.go index 968ae0a..7a962d6 100644 --- a/cmd/cz/cz.go +++ b/cmd/cz/cz.go @@ -16,7 +16,7 @@ func New() *cobra.Command { c := &cobra.Command{ Use: "commitizen", Long: `Command line utility to standardize git commit messages.`, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { isRepo, err := git.IsGitRepo() if err != nil { return err diff --git a/cmd/cz/init.go b/cmd/cz/init.go index ebeead6..445711d 100644 --- a/cmd/cz/init.go +++ b/cmd/cz/init.go @@ -14,7 +14,7 @@ func NewInitCmd() *cobra.Command { c := &cobra.Command{ Use: "init", Short: "Initialize this tool to git-core as git-cz.", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(_ *cobra.Command, _ []string) error { src, err := exec.LookPath(os.Args[0]) if err != nil { return err diff --git a/cmd/cz/version.go b/cmd/cz/version.go index f79f3db..0d5e88d 100644 --- a/cmd/cz/version.go +++ b/cmd/cz/version.go @@ -11,7 +11,7 @@ func NewVersionCmd() *cobra.Command { c := &cobra.Command{ Use: "version", Short: "Print the version information.", - Run: func(cmd *cobra.Command, args []string) { + Run: func(_ *cobra.Command, _ []string) { fmt.Println(version.Get().String()) }, } diff --git a/internal/config/config.go b/internal/config/config.go index 49825e0..2d18d12 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -138,9 +138,6 @@ func load(reader io.Reader) ([]*render.Template, error) { } return nil, err } - if tmpl == nil { - continue - } templates = append(templates, tmpl) } diff --git a/internal/render/template.go b/internal/render/template.go index f03bab0..77757ac 100644 --- a/internal/render/template.go +++ b/internal/render/template.go @@ -7,6 +7,7 @@ import ( "text/template" tea "github.com/charmbracelet/bubbletea" + "github.com/shipengqi/commitizen/internal/ui" ) diff --git a/internal/ui/select.go b/internal/ui/select.go index 524df1f..dd9ef18 100644 --- a/internal/ui/select.go +++ b/internal/ui/select.go @@ -63,7 +63,6 @@ func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list type SelectModel struct { label string choice string - finished bool canceled bool err error @@ -140,7 +139,7 @@ func (m *SelectModel) View() string { "%s %s\n%s\n", FontColor(DefaultValidateOkPrefix, colorValidateOk), m.label, - quitValueStyle.Render(fmt.Sprintf(val)), + quitValueStyle.Render(val), ) } return "\n" + m.list.View() diff --git a/internal/ui/textarea.go b/internal/ui/textarea.go index e1726c3..9ec198a 100644 --- a/internal/ui/textarea.go +++ b/internal/ui/textarea.go @@ -2,6 +2,7 @@ package ui import ( "fmt" + "github.com/charmbracelet/bubbles/help" "github.com/charmbracelet/bubbles/key" "github.com/charmbracelet/bubbles/textarea" @@ -145,7 +146,7 @@ func (m *TextAreaModel) View() string { "%s %s\n%s\n", FontColor(m.validateOkPrefix, colorValidateOk), m.label, - quitValueStyle.Render(fmt.Sprintf(m.Value())), + quitValueStyle.Render(m.Value()), ) }