Skip to content

Commit 0efb982

Browse files
authored
Revert "feat: add INCLUDE_ORGS env variable (#2275)" (#2276)
This reverts commit ada9cf4.
1 parent ada9cf4 commit 0efb982

File tree

3 files changed

+10
-29
lines changed

3 files changed

+10
-29
lines changed

src/common/utils.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const isValidHexColor = (hexColor) => {
7777
/**
7878
* Returns boolean if value is either "true" or "false" else the value as it is.
7979
*
80-
* @param {string | boolean| undefined} value The value to parse.
80+
* @param {string | boolean} value The value to parse.
8181
* @returns {boolean | undefined } The parsed value.
8282
*/
8383
const parseBoolean = (value) => {

src/fetchers/stats-fetcher.js

+6-19
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
CustomError,
88
logger,
99
MissingParamError,
10-
parseBoolean,
1110
request,
1211
wrapTextMultiline,
1312
} from "../common/utils.js";
@@ -23,7 +22,7 @@ const fetcher = (variables, token) => {
2322
return request(
2423
{
2524
query: `
26-
query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
25+
query userInfo($login: String!) {
2726
user(login: $login) {
2827
name
2928
login
@@ -46,7 +45,7 @@ const fetcher = (variables, token) => {
4645
followers {
4746
totalCount
4847
}
49-
repositories(ownerAffiliations: $ownerAffiliations) {
48+
repositories(ownerAffiliations: OWNER) {
5049
totalCount
5150
}
5251
}
@@ -71,9 +70,9 @@ const repositoriesFetcher = (variables, token) => {
7170
return request(
7271
{
7372
query: `
74-
query userInfo($login: String!, $after: String, $ownerAffiliations: [RepositoryAffiliation]) {
73+
query userInfo($login: String!, $after: String) {
7574
user(login: $login) {
76-
repositories(first: 100, ownerAffiliations: $ownerAffiliations, orderBy: {direction: DESC, field: STARGAZERS}, after: $after) {
75+
repositories(first: 100, ownerAffiliations: OWNER, orderBy: {direction: DESC, field: STARGAZERS}, after: $after) {
7776
nodes {
7877
name
7978
stargazers {
@@ -150,14 +149,7 @@ const totalStarsFetcher = async (username, repoToHide) => {
150149
let hasNextPage = true;
151150
let endCursor = null;
152151
while (hasNextPage) {
153-
const variables = {
154-
login: username,
155-
first: 100,
156-
after: endCursor,
157-
ownerAffiliations: parseBoolean(process.env.INCLUDE_ORGS)
158-
? ["OWNER", "COLLABORATOR"]
159-
: ["OWNER"],
160-
};
152+
const variables = { login: username, first: 100, after: endCursor };
161153
let res = await retryer(repositoriesFetcher, variables);
162154

163155
if (res.data.errors) {
@@ -211,12 +203,7 @@ const fetchStats = async (
211203
rank: { level: "C", score: 0 },
212204
};
213205

214-
let res = await retryer(fetcher, {
215-
login: username,
216-
ownerAffiliations: parseBoolean(process.env.INCLUDE_ORGS)
217-
? ["OWNER", "COLLABORATOR"]
218-
: ["OWNER"],
219-
});
206+
let res = await retryer(fetcher, { login: username });
220207

221208
// Catch GraphQL errors.
222209
if (res.data.errors) {

src/fetchers/top-languages-fetcher.js

+3-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
CustomError,
55
logger,
66
MissingParamError,
7-
parseBoolean,
87
request,
98
wrapTextMultiline,
109
} from "../common/utils.js";
@@ -20,10 +19,10 @@ const fetcher = (variables, token) => {
2019
return request(
2120
{
2221
query: `
23-
query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
22+
query userInfo($login: String!) {
2423
user(login: $login) {
2524
# fetch only owner repos & not forks
26-
repositories(ownerAffiliations: $ownerAffiliations, isFork: false, first: 100) {
25+
repositories(ownerAffiliations: OWNER, isFork: false, first: 100) {
2726
nodes {
2827
name
2928
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
@@ -58,12 +57,7 @@ const fetcher = (variables, token) => {
5857
const fetchTopLanguages = async (username, exclude_repo = []) => {
5958
if (!username) throw new MissingParamError(["username"]);
6059

61-
const res = await retryer(fetcher, {
62-
login: username,
63-
ownerAffiliations: parseBoolean(process.env.INCLUDE_ORGS)
64-
? ["OWNER", "COLLABORATOR"]
65-
: ["OWNER"],
66-
});
60+
const res = await retryer(fetcher, { login: username });
6761

6862
if (res.data.errors) {
6963
logger.error(res.data.errors);

0 commit comments

Comments
 (0)