mirror of
https://github.com/r-freeman/portfolio.git
synced 2024-11-22 19:45:40 +00:00
Added github username env variable
This commit is contained in:
parent
99d70b1d98
commit
e3d378ccdc
@ -5,3 +5,4 @@ NEXT_PUBLIC_SITE_URL=https://example.com
|
|||||||
DATABASE_URL=
|
DATABASE_URL=
|
||||||
SHADOW_DATABASE_URL=
|
SHADOW_DATABASE_URL=
|
||||||
GITHUB_ACCESS_TOKEN=
|
GITHUB_ACCESS_TOKEN=
|
||||||
|
GITHUB_USERNAME=
|
@ -2,6 +2,7 @@ import type {Repo} from '@/types'
|
|||||||
import fetcher from "@/lib/fetcher";
|
import fetcher from "@/lib/fetcher";
|
||||||
|
|
||||||
const GITHUB_ACCESS_TOKEN = process.env.GITHUB_ACCESS_TOKEN
|
const GITHUB_ACCESS_TOKEN = process.env.GITHUB_ACCESS_TOKEN
|
||||||
|
const GITHUB_USERNAME = process.env.GITHUB_USERNAME
|
||||||
const GITHUB_GRAPHQL = "https://api.github.com/graphql"
|
const GITHUB_GRAPHQL = "https://api.github.com/graphql"
|
||||||
|
|
||||||
type PinnedReposResponse = {
|
type PinnedReposResponse = {
|
||||||
@ -59,7 +60,7 @@ export async function getPinnedRepos() {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
query: `{
|
query: `{
|
||||||
user(login: "r-freeman") {
|
user(login: "${GITHUB_USERNAME}") {
|
||||||
pinnedItems(first: 6, types: REPOSITORY) {
|
pinnedItems(first: 6, types: REPOSITORY) {
|
||||||
nodes {
|
nodes {
|
||||||
... on Repository {
|
... on Repository {
|
||||||
@ -92,7 +93,7 @@ export async function getTotalRepos() {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
query: `{
|
query: `{
|
||||||
user(login: "r-freeman") {
|
user(login: "${GITHUB_USERNAME}") {
|
||||||
repositories {
|
repositories {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
@ -113,7 +114,7 @@ export async function getTotalFollowers() {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
query: `{
|
query: `{
|
||||||
user(login: "r-freeman") {
|
user(login: "${GITHUB_USERNAME}") {
|
||||||
followers {
|
followers {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
@ -134,7 +135,7 @@ export async function getTotalStars(totalRepos: number) {
|
|||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
query: `{
|
query: `{
|
||||||
user(login: "r-freeman") {
|
user(login: "${GITHUB_USERNAME}") {
|
||||||
repositories(first: ${totalRepos}) {
|
repositories(first: ${totalRepos}) {
|
||||||
nodes {
|
nodes {
|
||||||
stargazers {
|
stargazers {
|
||||||
|
Loading…
Reference in New Issue
Block a user