generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from ericsciple/users/ericsciple/m262ghes
Use @actions/github to invoke GraphQL for GHES compatibility
- Loading branch information
Showing
5 changed files
with
82 additions
and
68 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {GitHub} from '@actions/github' | ||
import {GraphQlQueryResponseData} from '@octokit/graphql/dist-types/types' | ||
import {RequestParameters} from '@octokit/types/dist-types/RequestParameters' | ||
|
||
/** | ||
* Sends a GraphQL query request based on endpoint options | ||
* | ||
* @param {string} token Auth token | ||
* @param {string} query GraphQL query. Example: `'query { viewer { login } }'`. | ||
* @param {object} parameters URL, query or body parameters, as well as `headers`, `mediaType.{format|previews}`, `request`, or `baseUrl`. | ||
*/ | ||
export async function graphql( | ||
token: string, | ||
query: string, | ||
parameters: RequestParameters | ||
): Promise<GraphQlQueryResponseData> { | ||
const github = new GitHub(token) | ||
return await github.graphql(query, parameters) | ||
} |