From ea6d5d265949fc43550adadb592286baf5bece07 Mon Sep 17 00:00:00 2001 From: suba <84484832+suba327777@users.noreply.github.com> Date: Sun, 26 May 2024 17:57:47 +0900 Subject: [PATCH 1/5] fix: text font bold --- ui/card.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/card.go b/ui/card.go index cd8d568..74686b8 100644 --- a/ui/card.go +++ b/ui/card.go @@ -17,7 +17,7 @@ func title(mountainIcon, textColor, username string) string { return fmt.Sprintf(` %s - %s + %s `, mountainIcon, textColor, username) } @@ -27,14 +27,14 @@ func leftInfo(dailyCommitsMonthCount, endOfMonth, commitsYearCount int, treeIcon %s - commit day - per month - %d/%d + Commit Day + Per Month + %d/%d - %s Total Commits - (2024) - %d + %s Total Commits + (2024) + %d From c77e6d08417ba2e3accb9bd0a36b6917d6c0e2c8 Mon Sep 17 00:00:00 2001 From: suba <84484832+suba327777@users.noreply.github.com> Date: Sun, 26 May 2024 19:18:44 +0900 Subject: [PATCH 2/5] add: format number fn --- ui/utils.go | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 ui/utils.go diff --git a/ui/utils.go b/ui/utils.go new file mode 100644 index 0000000..49a3d80 --- /dev/null +++ b/ui/utils.go @@ -0,0 +1,11 @@ +package ui + +import "fmt" + +func formatNumber(num int) string { + if num >= 1000 { + return fmt.Sprintf("%.1fk", float64(num)/1000) + } else { + return fmt.Sprintf("%d", num) + } +} From 6817dbe2e445ac5f19d283e5cf846ebcfb6ffb17 Mon Sep 17 00:00:00 2001 From: suba <84484832+suba327777@users.noreply.github.com> Date: Sun, 26 May 2024 19:19:05 +0900 Subject: [PATCH 3/5] update: format commits year count --- ui/card.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/card.go b/ui/card.go index 74686b8..6b6bf73 100644 --- a/ui/card.go +++ b/ui/card.go @@ -22,23 +22,23 @@ func title(mountainIcon, textColor, username string) string { `, mountainIcon, textColor, username) } -func leftInfo(dailyCommitsMonthCount, endOfMonth, commitsYearCount int, treeIcon, climberIcon, textColor string) string { +func leftInfo(dailyCommitsMonthCount, endOfMonth int, treeIcon, climberIcon, textColor, formatCommitsYearCount string) string { return fmt.Sprintf(` %s Commit Day Per Month - %d/%d + %d/%d %s Total Commits (2024) - %d + %s - `, treeIcon, textColor, textColor, textColor, dailyCommitsMonthCount, endOfMonth, climberIcon, textColor, textColor, textColor, commitsYearCount) + `, treeIcon, textColor, textColor, textColor, dailyCommitsMonthCount, endOfMonth, climberIcon, textColor, textColor, textColor, formatCommitsYearCount) } func rightInfo(bgColor, borderColor, grass string) string { @@ -64,11 +64,12 @@ func GenerateCard(username string, dailyCommitsSince1MonthCount, dailyCommitsMon climberIcon := changeIconColor(Climber, theme.IconColor) treeIcon := changeIconColor(Tree, theme.IconColor) grassMountain := generateMountain(dailyCommitsSince1MonthCount, theme.Name, theme.TriangleMountainColor) + formatCommitsYearCount := formatNumber(commitsYearCount) svg := startSVG() svg += rect(theme.BgColor, theme.BorderColor) svg += title(mountainIcon, theme.TitleColor, username) - svg += leftInfo(dailyCommitsMonthCount, endOfMonth, commitsYearCount, treeIcon, climberIcon, theme.TextColor) + svg += leftInfo(dailyCommitsMonthCount, endOfMonth, treeIcon, climberIcon, theme.TextColor, formatCommitsYearCount) svg += rightInfo(theme.BgColor, theme.BorderColor, grassMountain) svg += endSVG() From 3de0d7e534b1cb217a23781f297a2248bc6b585e Mon Sep 17 00:00:00 2001 From: suba <84484832+suba327777@users.noreply.github.com> Date: Sun, 26 May 2024 19:46:00 +0900 Subject: [PATCH 4/5] update: example workflow --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 50d38d8..eef40b4 100644 --- a/README.md +++ b/README.md @@ -42,12 +42,18 @@ jobs: - name: Checkout uses: actions/checkout@v3 - name: Use README.Mountain - uses: suba327777/README.Mountain@main + uses: suba327777/README.Mountain@release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} USERNAME: ${{ github.repository_owner }} # select theme THEME: "default" + - name: Diff + id: diff + run: | + git add -N . + git diff --name-only --exit-code + continue-on-error: true - name: commit & push run: | git config user.name "github-actions[bot]" @@ -55,6 +61,7 @@ jobs: git add . git commit -m "[μRM] generate svg." git push + if: steps.diff.outcome == 'failure' ``` ## dependency, environments From 7a967070ee113bd95883eac433ed60e55a3fb127 Mon Sep 17 00:00:00 2001 From: suba <84484832+suba327777@users.noreply.github.com> Date: Sun, 26 May 2024 19:48:14 +0900 Subject: [PATCH 5/5] remove: lll --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 202eb7a..22a690b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,5 +8,4 @@ linters: - gosimple - varcheck - misspell - - lll - gofumpt