feat: flip include-forks / include-private defaults to true

Most users reach for ghstats to show their real activity. Making the
two visibility toggles opt-out rather than opt-in gives accurate stats
out of the box.

- -include-forks        false → true
- -include-private      false → true
- include_forks input   false → true
- include_private input false → true

Private-repo data silently no-ops when the token lacks repo scope, so
the default is safe for default github.token runs — it just won't
surface more than read:user already allows. Users who want the old
public-only behavior pass -include-private=false or set the Action
input to "false".
This commit is contained in:
tiennm99 committed 2026-04-18 22:20:46 +07:00
1 parent a02d27511a
commit d3fc27f33f
4 files changed
+17 -15

No files matched your search

+10 -8
View File
@@ -47,8 +47,8 @@ jobs:
token: ${{ secrets.GHSTATS_TOKEN }} # classic PAT with read:user + repo
themes: dracula,github_dark,tokyonight
tz: Asia/Saigon
include_forks: "false"
include_private: "false"
include_forks: "true"
include_private: "true"
commit_changes: "true"
```
@@ -77,8 +77,8 @@ Then embed the cards in your `README.md`:
| `tz` | `UTC` | IANA tz for the productive-time card (e.g. `Asia/Saigon`) |
| `top_repos` | `0` | Optional cap on seed repos probed for commit history (`0` = unlimited) |
| `commits_per_repo` | `500` | Max commits sampled per repo (covers last-year and all-time aggregates) |
| `include_forks` | `false` | Include forked repos in stats and commit probing |
| `include_private` | `false` | Include private repos (requires PAT with `repo` scope) |
| `include_forks` | `true` | Include forked repos in stats and commit probing |
| `include_private` | `true` | Include private repos (requires PAT with `repo` scope; silently no-op otherwise) |
| `commit_changes` | `false` | Commit generated cards back to the repo |
| `commit_message` | `chore: update ghstats cards` | Commit message |
| `commit_branch` | *(current ref)* | Target branch for auto-commit |
@@ -115,8 +115,8 @@ ghstats -user tiennm99 -themes dracula,github_dark -tz Asia/Saigon -out output
| `-tz` | `Local` | IANA timezone for productive-time cards |
| `-top-repos` | `0` | Optional cap on seed repos probed (`0` = unlimited) |
| `-commits-per-repo` | `500` | Max commits sampled per repo |
| `-include-forks` | `false` | Include forked repos in the stats |
| `-include-private` | `false` | Include private repos (requires `repo` PAT scope) |
| `-include-forks` | `true` | Include forked repos in the stats |
| `-include-private` | `true` | Include private repos (requires `repo` PAT scope; silently no-op otherwise) |
| `-list-themes` | | Print available theme ids and exit |
## How attribution works
@@ -164,8 +164,10 @@ themes are rebuilt on each run and gitignored.
The default `${{ github.token }}` can read public user data but will not see
your private-repo commits. For accurate stats, create a **classic** personal
access token with `read:user` and `repo`, save it as a repo secret (e.g.
`GHSTATS_TOKEN`), and pass it via the `token` input. Then pair with
`include_private: "true"` to have those commits actually counted.
`GHSTATS_TOKEN`), and pass it via the `token` input. `include_private`
defaults to `true` so those commits are counted automatically once the token
has `repo` scope; pass `include_private: "false"` if you want to keep private
work out of the rendered cards even when the token can see it.
## Credits & inspiration
+3 -3
View File
@@ -38,11 +38,11 @@ inputs:
include_forks:
description: Include forked repos in stats and commit probing
required: false
default: "false"
default: "true"
include_private:
description: Include private repos (requires PAT with repo scope)
description: Include private repos (requires PAT with repo scope; silently no-op otherwise)
required: false
default: "false"
default: "true"
commit_changes:
description: Whether to commit the generated cards back to the repo
required: false
+2 -2
View File
@@ -13,8 +13,8 @@ themes="${INPUT_THEMES:-dracula}"
tz="${INPUT_TZ:-UTC}"
top_repos="${INPUT_TOP_REPOS:-0}"
commits_per_repo="${INPUT_COMMITS_PER_REPO:-500}"
include_forks="${INPUT_INCLUDE_FORKS:-false}"
include_private="${INPUT_INCLUDE_PRIVATE:-false}"
include_forks="${INPUT_INCLUDE_FORKS:-true}"
include_private="${INPUT_INCLUDE_PRIVATE:-true}"
commit_changes="${INPUT_COMMIT_CHANGES:-false}"
commit_message="${INPUT_COMMIT_MESSAGE:-chore: update ghstats cards}"
commit_branch="${INPUT_COMMIT_BRANCH:-}"
+2 -2
View File
@@ -22,8 +22,8 @@ func main() {
tzName = flag.String("tz", "Local", "timezone for productive-time card (IANA name, e.g. Asia/Saigon)")
topRepos = flag.Int("top-repos", 0, "optional cap on seed repos probed for commit history (0 = unlimited)")
perRepo = flag.Int("commits-per-repo", 500, "max commits sampled per repo (covers both last-year and all-time aggregates)")
includeForks = flag.Bool("include-forks", false, "include forked repos in stats and commit probing")
includePrivate = flag.Bool("include-private", false, "include private repos (requires PAT with repo scope)")
includeForks = flag.Bool("include-forks", true, "include forked repos in stats and commit probing")
includePrivate = flag.Bool("include-private", true, "include private repos (requires PAT with repo scope; silently no-op otherwise)")
listThemes = flag.Bool("list-themes", false, "print available theme ids and exit")
)
flag.Parse()