Skip to content

Commit bcb3c0b

Browse files
authored
Merge develop into master (#12)
2 parents 2f15f02 + b428cda commit bcb3c0b

File tree

4 files changed

+22
-11
lines changed

4 files changed

+22
-11
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ This GitHub Action collects your GitHub data and coding activity from WakaTime.
5151
| `SECTION_NAME` | The section name in the `README.md` to update. | No | readme-stats |
5252
| `HIDE_REPO_INFO` | Whether to hide the repository information in action logs. | No | - |
5353
| `PROGRESS_BAR_VERSION` | The version of the progress bar to use. | No | 1 |
54+
| `EXCLUDE_FORK_REPOS` | Whether to exclude fork repositories from the metrics. | No | - |
55+
| `LANGUAGES_AND_TOOLS` | The languages and tools that you used in your repositories. | No | - |
56+
5457
### Metrics
5558
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:
5659

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

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

90-
**💬 Languages**
93+
**💬 Languages & Tools**
9194

9295
![JavaScript](https://img.shields.io/badge/JavaScript-20.0%25-f1e05a?&logo=JavaScript&labelColor=151b23)
9396
![Python](https://img.shields.io/badge/Python-13.0%25-3572A5?&logo=Python&labelColor=151b23)

action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ inputs:
4141
COMMIT_USER_EMAIL:
4242
description: 'Commit user email'
4343
required: false
44-
LANGUAGES_BASED_ON_REPO:
45-
description: 'Languages based on repository'
44+
LANGUAGES_AND_TOOLS:
45+
description: 'Languages and tools used in the repositories'
46+
required: false
47+
EXCLUDE_FORK_REPOS:
48+
description: 'Exclude fork repositories'
4649
required: false
4750
runs:
4851
using: docker

pkg/container/container.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ type DataContainer struct {
3333
// metrics returns the metrics map
3434
func (d *DataContainer) metrics(com *CommitStats, lang *LanguageStats) map[string]string {
3535
return map[string]string{
36-
"LANGUAGE_PER_REPO": writer.MakeLanguagePerRepoList(d.Data.Repositories),
37-
"LANGUAGES_BASED_ON_REPO": writer.MakeLanguageUsedList(lang.Languages, lang.TotalSize),
38-
"COMMIT_DAYS_OF_WEEK": writer.MakeCommitDaysOfWeekList(com.DailyCommits, com.TotalCommits),
39-
"COMMIT_TIME_OF_DAY": writer.MakeCommitTimeOfDayList(d.Data.Commits),
36+
"LANGUAGE_PER_REPO": writer.MakeLanguagePerRepoList(d.Data.Repositories),
37+
"LANGUAGES_AND_TOOLS": writer.MakeLanguageAndToolList(lang.Languages, lang.TotalSize),
38+
"COMMIT_DAYS_OF_WEEK": writer.MakeCommitDaysOfWeekList(com.DailyCommits, com.TotalCommits),
39+
"COMMIT_TIME_OF_DAY": writer.MakeCommitTimeOfDayList(d.Data.Commits),
4040
"WAKATIME_SPENT_TIME": writer.MakeWakaActivityList(
4141
d.Data.WakaTime,
4242
strings.Split(os.Getenv("WAKATIME_DATA"), ","),
@@ -100,6 +100,7 @@ func (d *DataContainer) InitRepositories(ctx context.Context) error {
100100
seenRepos := make(map[string]bool)
101101
errChan := make(chan error, 2)
102102
repoChan := make(chan []github.Repository, 2)
103+
isExcludeForks := os.Getenv("EXCLUDE_FORK_REPOS") == "true"
103104

104105
go func() {
105106
r, err := d.ClientManager.GetOwnedRepositories(ctx, d.Data.Viewer.Login, repoPerQuery)
@@ -138,6 +139,10 @@ func (d *DataContainer) InitRepositories(ctx context.Context) error {
138139
// Deduplicate repositories
139140
for repos := range repoChan {
140141
for _, repo := range repos {
142+
if isExcludeForks && repo.IsFork {
143+
continue
144+
}
145+
141146
if !seenRepos[repo.Url] {
142147
seenRepos[repo.Url] = true
143148
d.Data.Repositories = append(d.Data.Repositories, repo)

pkg/writer/writer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ func (w WeekTime) String() string {
4141
return longWeekTimeNames[w]
4242
}
4343

44-
// MakeLanguageUsedList returns a list of languages used in repositories
45-
func MakeLanguageUsedList(l map[string][2]interface{}, totalSize int) string {
44+
// MakeLanguageAndToolList returns a list of languages and tools used in the repositories
45+
func MakeLanguageAndToolList(l map[string][2]interface{}, totalSize int) string {
4646
if len(l) == 0 {
4747
return ""
4848
}
@@ -60,7 +60,7 @@ func MakeLanguageUsedList(l map[string][2]interface{}, totalSize int) string {
6060
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))
6161
}
6262

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

6666
// MakeWakaActivityList returns a list of activities

0 commit comments

Comments
 (0)