1
- import { Octokit } from "@octokit/rest " ;
1
+ import { request } from "@octokit/request " ;
2
2
import { clsx , type ClassValue } from "clsx" ;
3
3
import { twMerge } from "tailwind-merge" ;
4
4
import { env } from "~/env.mjs" ;
@@ -20,11 +20,7 @@ export type VersionsGroupedByMajor = Array<{
20
20
} > ;
21
21
22
22
export const getT3Versions = async ( ) => {
23
- const octokit = new Octokit ( {
24
- auth : env . GITHUB_PERSONAL_ACCESS_TOKEN ,
25
- } ) ;
26
-
27
- const releases = await octokit . repos . listReleases ( {
23
+ const releases = await request ( "GET /repos/{owner}/{repo}/releases" , {
28
24
owner : "t3-oss" ,
29
25
repo : "create-t3-app" ,
30
26
per_page : 100 ,
@@ -143,19 +139,18 @@ export interface DiffLocation {
143
139
}
144
140
145
141
export const getDiffFromGithub = async ( props : DiffLocation ) => {
146
- const octokit = new Octokit ( {
147
- auth : env . GITHUB_PERSONAL_ACCESS_TOKEN ,
148
- } ) ;
149
-
150
142
const featuresString = getFeaturesString ( props . features ) ;
151
143
const path = `diffs/diff-${ props . currentVersion } -${ props . upgradeVersion } ${
152
144
featuresString ? `-${ featuresString } ` : ""
153
145
} .patch`;
154
146
155
- const { data } = await octokit . repos . getContent ( {
147
+ const { data } = await request ( "GET /repos/{owner}/{repo}/contents/{path}" , {
156
148
owner : env . GITHUB_DIFFS_OWNER ,
157
149
repo : env . GITHUB_DIFFS_REPO ,
158
150
path,
151
+ headers : {
152
+ authorization : `token ${ env . GITHUB_PERSONAL_ACCESS_TOKEN } ` ,
153
+ } ,
159
154
} ) ;
160
155
161
156
if ( Array . isArray ( data ) ) {
0 commit comments