Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ This GitHub Action collects your GitHub data and coding activity from WakaTime.
| `SECTION_NAME` | The section name in the `README.md` to update. | No | readme-stats |
| `HIDE_REPO_INFO` | Whether to hide the repository information in action logs. | No | - |
| `PROGRESS_BAR_VERSION` | The version of the progress bar to use. | No | 1 |
| `EXCLUDE_FORK_REPOS` | Whether to exclude fork repositories from the metrics. | No | - |
| `LANGUAGES_AND_TOOLS` | The languages and tools that you used in your repositories. | No | - |

### Metrics
The `SHOW_METRICS` environment variable is used to specify the metrics to show in the `README.md` file. You can choose from the following metrics:

Expand Down Expand Up @@ -85,9 +88,9 @@ The `SHOW_METRICS` environment variable is used to specify the metrics to show i
TypeScript 1 repo ████░░░░░░░░░░░░░░░░░░░░░ 14.29%
```

**LANGUAGES_BASED_ON_REPO**: The languages you use in each repository. Percentage is based on the total bytes of code in each language.
**LANGUAGES_AND_TOOLS**: The languages and tools you used on your projects.

**💬 Languages**
**💬 Languages & Tools**

![JavaScript](https://img.shields.io/badge/JavaScript-20.0%25-f1e05a?&logo=JavaScript&labelColor=151b23)
![Python](https://img.shields.io/badge/Python-13.0%25-3572A5?&logo=Python&labelColor=151b23)
Expand Down
7 changes: 5 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ inputs:
COMMIT_USER_EMAIL:
description: 'Commit user email'
required: false
LANGUAGES_BASED_ON_REPO:
description: 'Languages based on repository'
LANGUAGES_AND_TOOLS:
description: 'Languages and tools used in the repositories'
required: false
EXCLUDE_FORK_REPOS:
description: 'Exclude fork repositories'
required: false
runs:
using: docker
Expand Down
13 changes: 9 additions & 4 deletions pkg/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ type DataContainer struct {
// metrics returns the metrics map
func (d *DataContainer) metrics(com *CommitStats, lang *LanguageStats) map[string]string {
return map[string]string{
"LANGUAGE_PER_REPO": writer.MakeLanguagePerRepoList(d.Data.Repositories),
"LANGUAGES_BASED_ON_REPO": writer.MakeLanguageUsedList(lang.Languages, lang.TotalSize),
"COMMIT_DAYS_OF_WEEK": writer.MakeCommitDaysOfWeekList(com.DailyCommits, com.TotalCommits),
"COMMIT_TIME_OF_DAY": writer.MakeCommitTimeOfDayList(d.Data.Commits),
"LANGUAGE_PER_REPO": writer.MakeLanguagePerRepoList(d.Data.Repositories),
"LANGUAGES_AND_TOOLS": writer.MakeLanguageAndToolList(lang.Languages, lang.TotalSize),
"COMMIT_DAYS_OF_WEEK": writer.MakeCommitDaysOfWeekList(com.DailyCommits, com.TotalCommits),
"COMMIT_TIME_OF_DAY": writer.MakeCommitTimeOfDayList(d.Data.Commits),
"WAKATIME_SPENT_TIME": writer.MakeWakaActivityList(
d.Data.WakaTime,
strings.Split(os.Getenv("WAKATIME_DATA"), ","),
Expand Down Expand Up @@ -100,6 +100,7 @@ func (d *DataContainer) InitRepositories(ctx context.Context) error {
seenRepos := make(map[string]bool)
errChan := make(chan error, 2)
repoChan := make(chan []github.Repository, 2)
isExcludeForks := os.Getenv("EXCLUDE_FORK_REPOS") == "true"

go func() {
r, err := d.ClientManager.GetOwnedRepositories(ctx, d.Data.Viewer.Login, repoPerQuery)
Expand Down Expand Up @@ -138,6 +139,10 @@ func (d *DataContainer) InitRepositories(ctx context.Context) error {
// Deduplicate repositories
for repos := range repoChan {
for _, repo := range repos {
if isExcludeForks && repo.IsFork {
continue
}

if !seenRepos[repo.Url] {
seenRepos[repo.Url] = true
d.Data.Repositories = append(d.Data.Repositories, repo)
Expand Down
6 changes: 3 additions & 3 deletions pkg/writer/writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ func (w WeekTime) String() string {
return longWeekTimeNames[w]
}

// MakeLanguageUsedList returns a list of languages used in repositories
func MakeLanguageUsedList(l map[string][2]interface{}, totalSize int) string {
// MakeLanguageAndToolList returns a list of languages and tools used in the repositories
func MakeLanguageAndToolList(l map[string][2]interface{}, totalSize int) string {
if len(l) == 0 {
return ""
}
Expand All @@ -60,7 +60,7 @@ func MakeLanguageUsedList(l map[string][2]interface{}, totalSize int) string {
res.WriteString(fmt.Sprintf("![%s](https://img.shields.io/badge/%s-%05.2f%%25-%s?&logo=%s&labelColor=151b23)\n", k, k, float64(s)/float64(totalSize)*100, c[1:], k))
}

return "**💬 Languages**\n\n" + res.String() + "\n\n"
return "**💬 Languages & Tools**\n\n" + res.String() + "\n\n"
}

// MakeWakaActivityList returns a list of activities
Expand Down