-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ebab67
commit 0d0eff7
Showing
24 changed files
with
929 additions
and
968 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
import { gql } from './utils.js' | ||
|
||
export default { | ||
gql: gql` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
import { gql } from './utils.js' | ||
|
||
export default { | ||
gql: gql` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
import { gql } from './utils.js' | ||
|
||
export default { | ||
gql: gql` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
import { gql } from './utils.js' | ||
|
||
export default { | ||
gql: gql` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
import { gql } from './utils.js' | ||
|
||
export default { | ||
gql: gql` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
import { gql } from './utils.js' | ||
|
||
export default { | ||
gql: gql` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { gql } from '@solid-primitives/graphql' | ||
import { gql } from './utils.js' | ||
|
||
export default { | ||
gql: gql` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Creates a GraphQL query string. | ||
*/ | ||
export const gql = (query, ...expressions) => | ||
query | ||
.map((s, i) => `${s}${expressions[i] ?? ''}`) | ||
.join('') | ||
.replace(/#.+\r?\n|\r/g, '') | ||
.replace(/\r?\n|\r/g, '') | ||
.replace(/\s{2,}/g, ' ') | ||
.trim() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { ghClient } from './octokit.js' | ||
|
||
export default async function graphQLFetch(query, variables) { | ||
'use server' | ||
|
||
const octokit = ghClient() | ||
|
||
return octokit.graphql(query, variables) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Octokit } from '@octokit/core' | ||
import { createAppAuth } from '@octokit/auth-app' | ||
|
||
export function ghClient() { | ||
'use server' | ||
|
||
if (process.env.GH_PAT) { | ||
// with personal access token (local development) | ||
return new Octokit({ auth: process.env.GH_PAT }) | ||
} else { | ||
// with GitHub App (production) | ||
const appOctokit = new Octokit({ | ||
authStrategy: createAppAuth, | ||
auth: { | ||
appId: process.env.GH_APP_ID, | ||
privateKey: atob(process.env.GH_PRIVATE_KEY), | ||
installationId: process.env.GH_APP_INSTALLATION_ID | ||
} | ||
}) | ||
|
||
return appOctokit | ||
} | ||
} |
Oops, something went wrong.