mirror of
https://github.com/anuraghazra/github-readme-stats.git
synced 2025-01-30 14:08:14 +08:00
feat: remove 'include_private' (#2736)
* feat: remove 'include_private' As explained in #2517 the 'include_private' flag is confusing and doesn't work as expected. This commit therefore removes this flag. * fix: fix tests * docs: remove redundant private deploy note
This commit is contained in:
parent
0fe51cd539
commit
b9200c6cf6
@ -19,7 +19,6 @@ export default async (req, res) => {
|
||||
card_width,
|
||||
hide_rank,
|
||||
show_icons,
|
||||
count_private,
|
||||
include_all_commits,
|
||||
line_height,
|
||||
title_color,
|
||||
@ -52,7 +51,6 @@ export default async (req, res) => {
|
||||
try {
|
||||
const stats = await fetchStats(
|
||||
username,
|
||||
parseBoolean(count_private),
|
||||
parseBoolean(include_all_commits),
|
||||
parseArray(exclude_repo),
|
||||
);
|
||||
|
@ -111,7 +111,7 @@ Change the `?username=` value to your GitHub username.
|
||||
```
|
||||
|
||||
> **Warning**
|
||||
> By default, the stats card shows contributions only from public repositories. To show your private contributions, you should [deploy your own instance](#deploy-on-your-own) using your own GitHub API token, allowing you to see your private data.
|
||||
> By default, the stats card only shows statistics like stars, commits and pull requests from public repositories. To show private statistics on the stats card, you should [deploy your own instance](#deploy-on-your-own) using your own GitHub API token.
|
||||
|
||||
> **Note**
|
||||
> Available ranks are S+ (top 1%), S (top 25%), A++ (top 45%), A+ (top 60%), and B+ (everyone). The values are calculated by using the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) using commits, contributions, issues, stars, pull requests, followers, and owned repositories. The implementation can be investigated at [src/calculateRank.js](./src/calculateRank.js).
|
||||
@ -276,7 +276,6 @@ You can provide multiple comma-separated values in the bg_color option to render
|
||||
- `rank_icon` - Shows alternative rank icon (i.e. `github` or `default`). Default: `default`.
|
||||
- `show_icons` - _(boolean)_. Default: `false`.
|
||||
- `include_all_commits` - Count total commits instead of just the current year commits _(boolean)_. Default: `false`.
|
||||
- `count_private` - Count private contributions _(boolean)_. Default: `false`.
|
||||
- `line_height` - Sets the line height between text _(number)_. Default: `25`.
|
||||
- `exclude_repo` - Exclude stars from specified repositories _(Comma-separated values)_. Default: `[] (blank array)`.
|
||||
- `custom_title` - Sets a custom title for the card. Default: `<username> GitHub Stats`.
|
||||
@ -352,6 +351,9 @@ Use [show_owner](#customization) variable to include the repo's owner username
|
||||
|
||||
The top languages card shows a GitHub user's most frequently used top language.
|
||||
|
||||
> **Warning**
|
||||
> By default, the language card shows language results only from public repositories. To include languages used in private repositories, you should [deploy your own instance](#deploy-on-your-own) using your own GitHub API token.
|
||||
|
||||
> **Note**
|
||||
> Top Languages does not indicate the user's skill level or anything like that; it's a GitHub metric to determine which languages have the most code on GitHub. It is a new feature of github-readme-stats.
|
||||
|
||||
|
@ -173,13 +173,11 @@ const totalCommitsFetcher = async (username) => {
|
||||
* Fetch stats for a given username.
|
||||
*
|
||||
* @param {string} username GitHub username.
|
||||
* @param {boolean} count_private Include private contributions.
|
||||
* @param {boolean} include_all_commits Include all commits.
|
||||
* @returns {Promise<import("./types").StatsData>} Stats data.
|
||||
*/
|
||||
const fetchStats = async (
|
||||
username,
|
||||
count_private = false,
|
||||
include_all_commits = false,
|
||||
exclude_repo = [],
|
||||
) => {
|
||||
@ -229,12 +227,6 @@ const fetchStats = async (
|
||||
stats.totalCommits = user.contributionsCollection.totalCommitContributions;
|
||||
}
|
||||
|
||||
// if count_private, add private contributions to totalCommits.
|
||||
if (count_private) {
|
||||
stats.totalCommits +=
|
||||
user.contributionsCollection.restrictedContributionsCount;
|
||||
}
|
||||
|
||||
stats.totalPRs = user.pullRequests.totalCount;
|
||||
stats.totalIssues = user.openIssues.totalCount + user.closedIssues.totalCount;
|
||||
stats.contributedTo = user.repositoriesContributedTo.totalCount;
|
||||
|
@ -166,7 +166,7 @@ describe("Test fetchStats", () => {
|
||||
.onGet("https://api.github.com/search/commits?q=author:anuraghazra")
|
||||
.reply(200, { total_count: 1000 });
|
||||
|
||||
let stats = await fetchStats("anuraghazra", false, true);
|
||||
let stats = await fetchStats("anuraghazra", true);
|
||||
const rank = calculateRank({
|
||||
all_commits: true,
|
||||
commits: 1000,
|
||||
@ -193,7 +193,7 @@ describe("Test fetchStats", () => {
|
||||
.onGet("https://api.github.com/search/commits?q=author:anuraghazra")
|
||||
.reply(200, { total_count: 1000 });
|
||||
|
||||
let stats = await fetchStats("anuraghazra", false, true, ["test-repo-1"]);
|
||||
let stats = await fetchStats("anuraghazra", true, ["test-repo-1"]);
|
||||
const rank = calculateRank({
|
||||
all_commits: true,
|
||||
commits: 1000,
|
||||
|
Loading…
Reference in New Issue
Block a user