Skip to content

Commit 4edda27

Browse files
committed
Use GraphQL variable syntax
1 parent 436458c commit 4edda27

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

api/top-langs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module.exports = async (req, res) => {
4848
topLangs = await fetchTopLanguages(
4949
username,
5050
parseArray(exclude_repo),
51-
parseArray(role).filter(value => ['OWNER', 'ORGANIZATION_MEMBER', 'COLLABORATOR'].includes(value)),
51+
parseArray(role),
5252
parseArray(hide),
5353
);
5454

src/fetchers/top-languages-fetcher.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ const retryer = require("../common/retryer");
33
require("dotenv").config();
44

55
const fetcher = (variables, token) => {
6-
let ownerAffiliations = ["OWNER"];
7-
if (variables.ownerAffiliations.length > 0) {
8-
ownerAffiliations = variables.ownerAffiliations;
9-
}
10-
delete variables.ownerAffiliations;
116
return request(
127
{
138
query: `
14-
query userInfo($login: String!) {
9+
query userInfo($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
1510
user(login: $login) {
16-
# fetch only owner repos & not forks
17-
repositories(ownerAffiliations: [${ownerAffiliations.join(', ')}], isFork: false, first: 100) {
11+
# do not fetch forks
12+
repositories(ownerAffiliations: $ownerAffiliations, isFork: false, first: 100) {
1813
nodes {
1914
name
2015
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {

0 commit comments

Comments
 (0)