Skip to content

Commit

Permalink
fix(select): displays the type of the commit without description when…
Browse files Browse the repository at this point in the history
… selected (#23)
  • Loading branch information
shipengqi authored Mar 8, 2024
1 parent 62f7098 commit 302cfb2
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/autolabel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v4
- uses: actions/checkout@v4
- uses: actions/labeler@v5
with:
repo-token: ${{ secrets.PAT }}
10 changes: 5 additions & 5 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
actions: read
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable
# Initializes the CodeQL tools for scanning.
- uses: github/codeql-action/init@v2
- uses: github/codeql-action/init@v3
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
- uses: github/codeql-action/autobuild@v2
- uses: github/codeql-action/analyze@v2
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
4 changes: 2 additions & 2 deletions .github/workflows/depsreview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/dependency-review-action@v3
- uses: actions/checkout@v4
- uses: actions/dependency-review-action@v4
with:
allow-licenses: BSD-2-Clause, BSD-3-Clause, MIT, Apache-2.0, MPL-1.0, MPL-1.1, MPL-2.0
2 changes: 1 addition & 1 deletion .github/workflows/gitleaks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/grype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
actions: read
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: anchore/scan-action@v3
with:
path: "."
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: stable # get the latest stable version from the go-versions repository manifest.
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v4
with:
args: --timeout=10m
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
name: "Release a version"

on:
tags:
- 'v*'
permissions:
contents: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # it is required fot the changelog to work correctly
- uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
distribution: goreleaser
version: latest
args: release --debug --clean

2 changes: 1 addition & 1 deletion .github/workflows/stale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v8
- uses: actions/stale@v9
with:
days-before-issue-stale: 30
days-before-issue-close: 14
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
.idea
_output

# Dependency directories (remove the comment below to include it)
# vendor/

# IDE
.idea
82 changes: 82 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

dist: _output
snapshot:
name_template: '{{ incpatch .Version }}-next'
builds:
- env:
- CGO_ENABLED=0
- GIT_TREE_STATE=clean
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm
- arm64
- ppc64le
ignore:
# don't build arm for darwin and arm/arm64 for windows
- goos: darwin
goarch: arm
- goos: darwin
goarch: ppc64le
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
- goos: windows
goarch: ppc64le
ldflags:
- -X "github.com/shipengqi/component-base/version.Version={{ .Tag }}" -X "github.com/shipengqi/component-base/version.GitCommit={{ .ShortCommit }}" -X "github.com/shipengqi/component-base/version.BuildDate={{ .Date }}" -X "github.com/shipengqi/component-base/version.GitTreeState={{ .Env.GIT_TREE_STATE }}"
archives:
- name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
# wrap_in_directory: true
files:
- LICENSE
- README.md
- CHANGELOG/**
# Can be used to change the archive formats for specific GOOSs.
# Most common use case is to archive as zip on Windows.
# Default is empty.
format_overrides:
- goos: windows
format: zip
checksum:
name_template: 'CHECKSUM'
changelog:
sort: asc
use: github
filters:
exclude:
- '^Merge'
groups:
- title: 'New Features'
regexp: "^.*feat.*:+.*$"
order: 100
- title: 'Bug Fixes'
regexp: "^.*fix.*:+.*$"
order: 200
- title: 'Dependency Updates'
regexp: "^.*(feat|fix)\\(deps\\)*:+.*$"
order: 300
- title: 'Documentation Updates'
regexp: "^.*docs.*:+.*$"
order: 400
- title: Other work
order: 9999
release:
# github:
# owner: shipengqi
# name: commitizen
# draft: false
# prerelease: auto
footer: |
**Full Changelog**: https://github.com/shipengqi/commitizen/compare/{{ .PreviousTag }}...{{ .Tag }}
# modelines, feel free to remove those if you don't want/use them:
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
10 changes: 9 additions & 1 deletion internal/ui/select.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,19 @@ func (m *SelectModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {

func (m *SelectModel) View() string {
if m.choice != "" {
// hardcode for the select value
// fix https://github.com/shipengqi/commitizen/issues/18
val := m.Value()
tokens := strings.Split(m.Value(), ":")
if len(tokens) > 0 {
val = tokens[0]
}

return fmt.Sprintf(
"%s %s\n%s\n",
FontColor(DefaultValidateOkPrefix, colorValidateOk),
m.label,
quitValueStyle.Render(fmt.Sprintf(m.Value())),
quitValueStyle.Render(fmt.Sprintf(val)),
)
}
return "\n" + m.list.View()
Expand Down

0 comments on commit 302cfb2

Please sign in to comment.