Skip to content

Commit

Permalink
refactor: Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
steezplusplus committed Sep 13, 2023
1 parent c76655d commit 0a75a67
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions octokit.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
import { Octokit } from '@octokit/rest';
import { GetResponseTypeFromEndpointMethod } from "@octokit/types";
import { GetResponseTypeFromEndpointMethod } from '@octokit/types';

// TODO Validators with Zod
const GIT_PAT = process.env.GIT_PAT;
const GIT_USERNAME = process.env.GIT_USERNAME;
const GIT_USERNAME = process.env.GIT_USERNAME;
const NODE_ENV = process.env.NODE_ENV;

const octokitClient = new Octokit({
auth: GIT_PAT,
userAgent: 'steezplusplus',
log: NODE_ENV === 'development' ? console : undefined
log: NODE_ENV === 'development' ? console : undefined,
});

type GetReposResponseType = GetResponseTypeFromEndpointMethod<
typeof octokitClient.repos.get
>;

type GetUserResponseType = GetResponseTypeFromEndpointMethod<typeof octokitClient.users.getAuthenticated>;
type GetUserResponseType = GetResponseTypeFromEndpointMethod<
typeof octokitClient.users.getAuthenticated
>;

/**
* https://octokit.github.io/rest.js/v20#users-get-authenticated
*/
export async function getUser() {
try {
const response: GetUserResponseType = await octokitClient.rest.users.getAuthenticated();
const response: GetUserResponseType =
await octokitClient.rest.users.getAuthenticated();

const filteredData = {
username: response.data.login,
Expand Down

0 comments on commit 0a75a67

Please sign in to comment.