mirror of
https://github.com/tiennm99/github-readme-stats.git
synced 2026-05-14 10:58:34 +00:00
This reverts commit ada9cf4e0e.
This commit is contained in:
+1
-1
@@ -77,7 +77,7 @@ const isValidHexColor = (hexColor) => {
|
||||
/**
|
||||
* Returns boolean if value is either "true" or "false" else the value as it is.
|
||||
*
|
||||
* @param {string | boolean| undefined} value The value to parse.
|
||||
* @param {string | boolean} value The value to parse.
|
||||
* @returns {boolean | undefined } The parsed value.
|
||||
*/
|
||||
const parseBoolean = (value) => {
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
CustomError,
|
||||
logger,
|
||||
MissingParamError,
|
||||
parseBoolean,
|
||||
request,
|
||||
wrapTextMultiline,
|
||||
} from "../common/utils.js";
|
||||
@@ -23,7 +22,7 @@ const fetcher = (variables, token) => {
|
||||
return request(
|
||||
{
|
||||
query: `
|
||||
query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
|
||||
query userInfo($login: String!) {
|
||||
user(login: $login) {
|
||||
name
|
||||
login
|
||||
@@ -46,7 +45,7 @@ const fetcher = (variables, token) => {
|
||||
followers {
|
||||
totalCount
|
||||
}
|
||||
repositories(ownerAffiliations: $ownerAffiliations) {
|
||||
repositories(ownerAffiliations: OWNER) {
|
||||
totalCount
|
||||
}
|
||||
}
|
||||
@@ -71,9 +70,9 @@ const repositoriesFetcher = (variables, token) => {
|
||||
return request(
|
||||
{
|
||||
query: `
|
||||
query userInfo($login: String!, $after: String, $ownerAffiliations: [RepositoryAffiliation]) {
|
||||
query userInfo($login: String!, $after: String) {
|
||||
user(login: $login) {
|
||||
repositories(first: 100, ownerAffiliations: $ownerAffiliations, orderBy: {direction: DESC, field: STARGAZERS}, after: $after) {
|
||||
repositories(first: 100, ownerAffiliations: OWNER, orderBy: {direction: DESC, field: STARGAZERS}, after: $after) {
|
||||
nodes {
|
||||
name
|
||||
stargazers {
|
||||
@@ -150,14 +149,7 @@ const totalStarsFetcher = async (username, repoToHide) => {
|
||||
let hasNextPage = true;
|
||||
let endCursor = null;
|
||||
while (hasNextPage) {
|
||||
const variables = {
|
||||
login: username,
|
||||
first: 100,
|
||||
after: endCursor,
|
||||
ownerAffiliations: parseBoolean(process.env.INCLUDE_ORGS)
|
||||
? ["OWNER", "COLLABORATOR"]
|
||||
: ["OWNER"],
|
||||
};
|
||||
const variables = { login: username, first: 100, after: endCursor };
|
||||
let res = await retryer(repositoriesFetcher, variables);
|
||||
|
||||
if (res.data.errors) {
|
||||
@@ -211,12 +203,7 @@ const fetchStats = async (
|
||||
rank: { level: "C", score: 0 },
|
||||
};
|
||||
|
||||
let res = await retryer(fetcher, {
|
||||
login: username,
|
||||
ownerAffiliations: parseBoolean(process.env.INCLUDE_ORGS)
|
||||
? ["OWNER", "COLLABORATOR"]
|
||||
: ["OWNER"],
|
||||
});
|
||||
let res = await retryer(fetcher, { login: username });
|
||||
|
||||
// Catch GraphQL errors.
|
||||
if (res.data.errors) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
CustomError,
|
||||
logger,
|
||||
MissingParamError,
|
||||
parseBoolean,
|
||||
request,
|
||||
wrapTextMultiline,
|
||||
} from "../common/utils.js";
|
||||
@@ -20,10 +19,10 @@ const fetcher = (variables, token) => {
|
||||
return request(
|
||||
{
|
||||
query: `
|
||||
query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
|
||||
query userInfo($login: String!) {
|
||||
user(login: $login) {
|
||||
# fetch only owner repos & not forks
|
||||
repositories(ownerAffiliations: $ownerAffiliations, isFork: false, first: 100) {
|
||||
repositories(ownerAffiliations: OWNER, isFork: false, first: 100) {
|
||||
nodes {
|
||||
name
|
||||
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
|
||||
@@ -58,12 +57,7 @@ const fetcher = (variables, token) => {
|
||||
const fetchTopLanguages = async (username, exclude_repo = []) => {
|
||||
if (!username) throw new MissingParamError(["username"]);
|
||||
|
||||
const res = await retryer(fetcher, {
|
||||
login: username,
|
||||
ownerAffiliations: parseBoolean(process.env.INCLUDE_ORGS)
|
||||
? ["OWNER", "COLLABORATOR"]
|
||||
: ["OWNER"],
|
||||
});
|
||||
const res = await retryer(fetcher, { login: username });
|
||||
|
||||
if (res.data.errors) {
|
||||
logger.error(res.data.errors);
|
||||
|
||||
Reference in New Issue
Block a user