@@ -51,8 +51,8 @@ const graphQLAuth = graphql.defaults({
5151 * actually count against the GraphQL rate limit.
5252 *
5353 * This contrasts with the REST API which would require 2 requests to get the same information:
54- * 1. Get the repo-level info like created_at and updated_at
55- * 2. Get the latest commit SHA
54+ * 1. Get the repo-level info like created_at and updated_at
55+ * 2. Get the latest commit SHA
5656 *
5757 * In testing, this query sped up the build script from 80 minutes to 60 minutes.
5858 *
@@ -61,25 +61,24 @@ const graphQLAuth = graphql.defaults({
6161 *
6262 * Repo info is returned in the format:
6363 * {
64- * repository: {
65- * createdAt: '2022-01-01T00:00:00Z',
66- * updatedAt: '2023-01-01T00:00:00Z',
67- * defaultBranchRef: {
68- * target: {
69- * oid: 'sha-123'
70- * }
71- * }
72- * },
73- * rateLimit: {
74- * cost: 1,
75- * remaining: 5000,
76- * resetAt: '2023-01-01T00:00:00Z'
77- * }
64+ * repository: {
65+ * createdAt: '2022-01-01T00:00:00Z',
66+ * updatedAt: '2023-01-01T00:00:00Z',
67+ * defaultBranchRef: {
68+ * target: {
69+ * oid: 'sha-123'
70+ * }
71+ * }
72+ * },
73+ * rateLimit: {
74+ * cost: 1,
75+ * remaining: 5000,
76+ * resetAt: '2023-01-01T00:00:00Z'
77+ * }
7878 * }
79- *
8079 * @param {string } owner - the repo owners
8180 * @param {string } name - the repo name
82- * @returns {Promise<import('@octokit/graphql').GraphQlQueryResponse > } - the repo info
81+ * @returns {Promise<import('@octokit/graphql').GraphQlQueryResponseData > } - the repo info
8382 */
8483export async function getRepo ( owner , name ) {
8584 const query = `
@@ -113,12 +112,10 @@ export async function getRepo (owner, name) {
113112
114113/**
115114 * Gets the tree for a repo with a given sha
116- *
117115 * @param {string } repoOwner - The owner of the repo
118116 * @param {string } repoName - The name of the repo
119117 * @param {string } treeSha - The sha of the tree
120- * @returns {Promise<import('@octokit/rest').Response<import('@octokit/rest').GitGetTreeResponse>> }
121- * @throws {RequestError } - If the request fails
118+ * @returns {Promise<import('@octokit/rest').RestEndpointMethodTypes['git']['getTree']['response']> } - the response
122119 */
123120export async function getTree ( repoOwner , repoName , treeSha ) {
124121 return await octokit . rest . git . getTree ( {
@@ -131,12 +128,10 @@ export async function getTree (repoOwner, repoName, treeSha) {
131128
132129/**
133130 * Gets the contents of a file in a repo
134- *
135131 * @param {string } repoOwner - The owner of the repo
136132 * @param {string } repoName - The name of the repo
137133 * @param {string } filePath - The path to the file
138- * @returns {Promise<import('@octokit/rest').Response<import('@octokit/rest').ReposGetContentResponse>> } - the file content
139- * @throws {RequestError } - If the request fails
134+ * @returns {Promise<import('@octokit/rest').RestEndpointMethodTypes['repos']['getContent']['response']> } - the file content
140135 */
141136export async function getFileContent ( repoOwner , repoName , filePath ) {
142137 return await octokit . rest . repos . getContent ( {
@@ -149,9 +144,7 @@ export async function getFileContent (repoOwner, repoName, filePath) {
149144
150145/**
151146 * Check rate limit
152- *
153- * @returns {number } - The number of remaining requests
154- * @throws {RequestError } - If the request fails
147+ * @returns {Promise<number> } - The number of remaining requests
155148 */
156149export async function getRemainingRateLimit ( ) {
157150 const rateLimit = await octokit . rest . rateLimit . get ( )
0 commit comments