Skip to content

Commit a93f9c5

Browse files
authored
Merge pull request #484 from capitalone-contributions/another-miablo-octokit
2 parents c7f8490 + f801119 commit a93f9c5

17 files changed

Lines changed: 1431 additions & 2937 deletions

File tree

package-lock.json

Lines changed: 1141 additions & 2705 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@
2222
"prepare": "husky || true"
2323
},
2424
"dependencies": {
25-
"@octokit/auth-app": "6.1.1",
25+
"@octokit/auth-app": "^7.1.5",
2626
"@octokit/graphql-schema": "15.26.0",
2727
"@primer/octicons-react": "19.15.2",
2828
"@primer/react": "36.27.0",
29+
"@probot/octokit-plugin-config": "^4.0.0",
2930
"@t3-oss/env-nextjs": "0.13.7",
3031
"@tanstack/react-query": "4.36.1",
3132
"@trpc/client": "10.45.3",
@@ -34,9 +35,9 @@
3435
"fast-safe-stringify": "2.1.1",
3536
"fuse.js": "7.1.0",
3637
"next": "16.2.6",
37-
"next-auth": "4.24.12",
38-
"octokit": "3.2.2",
39-
"probot": "13.4.7",
38+
"next-auth": "4.24.14",
39+
"octokit": "^5.0.5",
40+
"probot": "14.3.2",
4041
"proxy-agent": "6.5.0",
4142
"react": "18.3.1",
4243
"react-dom": "18.3.1",
@@ -50,6 +51,7 @@
5051
},
5152
"devDependencies": {
5253
"@eslint/js": "9.39.2",
54+
"@octokit/openapi-webhooks-types-transition": "^12.1.0",
5355
"@tanstack/eslint-plugin-query": "5.78.0",
5456
"@tsconfig/next": "^2.0.6",
5557
"@types/node": "^22.19.15",

src/app/[organizationId]/page.tsx

Lines changed: 111 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const Organization = () => {
138138
})
139139

140140
// perform search if there is a search value
141-
let forksSet = []
141+
let forksSet: typeof forks = []
142142
if (searchValue) {
143143
forksSet = fuse.search(searchValue).map((result) => result.item)
144144
} else {
@@ -167,116 +167,130 @@ const Organization = () => {
167167
aria-describedby="forks table"
168168
aria-labelledby="forks table"
169169
data={forksPaginationSet}
170-
columns={[
171-
{
172-
header: 'Repository',
173-
rowHeader: true,
174-
field: 'name',
175-
sortBy: 'alphanumeric',
176-
width: '400px',
177-
renderCell: (row) => {
178-
return (
179-
<Stack direction="horizontal" align="center">
180-
<Stack.Item>
181-
<Avatar
182-
src={row.parent.owner.avatarUrl ?? row.owner.avatarUrl}
183-
size={32}
184-
/>
185-
</Stack.Item>
186-
<Stack.Item grow={false}>
170+
columns={
171+
[
172+
{
173+
header: 'Repository',
174+
rowHeader: true,
175+
field: 'name',
176+
sortBy: 'alphanumeric',
177+
width: '400px',
178+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
179+
renderCell: (row: any) => {
180+
return (
181+
<Stack direction="horizontal" align="center">
187182
<Stack.Item>
188-
<Link
189-
sx={{
190-
paddingRight: '5px',
191-
fontWeight: 'bold',
192-
fontSize: 2,
193-
}}
194-
href={`/${orgData?.data?.id}/forks/${row.id}`}
195-
>
196-
{row.name}
197-
</Link>
198-
<Label variant="secondary">
199-
{row.isPrivate ? 'Private' : 'Public'}
200-
</Label>
183+
<Avatar
184+
src={
185+
row.parent.owner.avatarUrl ?? row.owner.avatarUrl
186+
}
187+
size={32}
188+
/>
201189
</Stack.Item>
202-
<Stack.Item>
203-
<Text sx={{ color: 'fg.muted' }}>
204-
Forked from{' '}
190+
<Stack.Item grow={false}>
191+
<Stack.Item>
205192
<Link
206-
href={`https://github.com/${row.parent.owner.login}/${row.parent.name}`}
207-
target="_blank"
208-
rel="noreferrer noopener"
209-
sx={{ color: 'fg.muted' }}
193+
sx={{
194+
paddingRight: '5px',
195+
fontWeight: 'bold',
196+
fontSize: 2,
197+
}}
198+
href={`/${orgData?.data?.id}/forks/${row.id}`}
210199
>
211-
{row.parent.owner.login}/{row.parent.name}
200+
{row.name}
212201
</Link>
213-
</Text>
202+
<Label variant="secondary">
203+
{row.isPrivate ? 'Private' : 'Public'}
204+
</Label>
205+
</Stack.Item>
206+
<Stack.Item>
207+
<Text sx={{ color: 'fg.muted' }}>
208+
Forked from{' '}
209+
<Link
210+
href={`https://github.com/${row.parent.owner.login}/${row.parent.name}`}
211+
target="_blank"
212+
rel="noreferrer noopener"
213+
sx={{ color: 'fg.muted' }}
214+
>
215+
{row.parent.owner.login}/{row.parent.name}
216+
</Link>
217+
</Text>
218+
</Stack.Item>
214219
</Stack.Item>
215-
</Stack.Item>
216-
</Stack>
217-
)
220+
</Stack>
221+
)
222+
},
218223
},
219-
},
220-
{
221-
header: 'Branches',
222-
field: 'refs.totalCount',
223-
width: 'auto',
224-
renderCell: (row) => {
225-
return (
226-
<Stack direction="horizontal">
227-
<Stack.Item>
228-
<Box>
229-
<Octicon
230-
icon={GitBranchIcon}
231-
color="fg.muted"
232-
size={16}
233-
></Octicon>
234-
<Text sx={{ paddingLeft: '3px', color: 'fg.muted' }}>
235-
{row.refs.totalCount}
236-
</Text>
237-
</Box>
238-
</Stack.Item>
239-
</Stack>
240-
)
241-
},
242-
},
243-
{
244-
header: 'Languages',
245-
field: 'languages',
246-
width: 'auto',
247-
renderCell: (row) => {
248-
const languages = row.languages.nodes
249-
250-
return (
251-
<Stack direction="horizontal">
252-
{languages.map((lang) => (
253-
<Stack.Item key={lang.name} grow={false}>
254-
<Box sx={{ display: 'flex', alignItems: 'center' }}>
224+
{
225+
header: 'Branches',
226+
field: 'refs.totalCount',
227+
width: 'auto',
228+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
229+
renderCell: (row: any) => {
230+
return (
231+
<Stack direction="horizontal">
232+
<Stack.Item>
233+
<Box>
255234
<Octicon
256-
icon={DotFillIcon}
257-
color={lang.color}
235+
icon={GitBranchIcon}
236+
color="fg.muted"
258237
size={16}
259238
></Octicon>
260-
<Text>{lang.name}</Text>
239+
<Text sx={{ paddingLeft: '3px', color: 'fg.muted' }}>
240+
{row.refs.totalCount}
241+
</Text>
261242
</Box>
262243
</Stack.Item>
263-
))}
264-
</Stack>
265-
)
244+
</Stack>
245+
)
246+
},
266247
},
267-
},
268-
{
269-
header: 'Updated',
270-
field: 'updatedAt',
271-
sortBy: 'datetime',
272-
width: 'auto',
273-
renderCell: (row) => {
274-
return (
275-
<RelativeTime date={new Date(row.updatedAt)} tense="past" />
276-
)
248+
{
249+
header: 'Languages',
250+
field: 'languages',
251+
width: 'auto',
252+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
253+
renderCell: (row: any) => {
254+
const languages = row.languages.nodes
255+
256+
return (
257+
<Stack direction="horizontal">
258+
{languages.map(
259+
(lang: { name: string; color: string }) => (
260+
<Stack.Item key={lang.name} grow={false}>
261+
<Box sx={{ display: 'flex', alignItems: 'center' }}>
262+
<Octicon
263+
icon={DotFillIcon}
264+
color={lang.color}
265+
size={16}
266+
></Octicon>
267+
<Text>{lang.name}</Text>
268+
</Box>
269+
</Stack.Item>
270+
),
271+
)}
272+
</Stack>
273+
)
274+
},
275+
},
276+
{
277+
header: 'Updated',
278+
field: 'updatedAt',
279+
sortBy: 'datetime',
280+
width: 'auto',
281+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
282+
renderCell: (row: any) => {
283+
return (
284+
<RelativeTime date={new Date(row.updatedAt)} tense="past" />
285+
)
286+
},
277287
},
278-
},
279-
]}
288+
// `satisfies` cannot be used here — under moduleResolution:"bundler", DataTable's generic Data
289+
// param isn't inferred from data prop, so `field` only accepts "id". `as any` is the only
290+
// workaround until @primer/react fixes DataTable generic inference (draft component).
291+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
292+
] as any
293+
}
280294
cellPadding="spacious"
281295
/>
282296
<Table.Pagination

src/app/api/auth/lib/nextauth-options.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ export const nextAuthOptions: AuthOptions = {
192192
})
193193

194194
// Check if any of the user's organizations are in the allowed orgs list
195-
if (orgs.some((org) => allowedOrgs.includes(org.login))) {
195+
if (
196+
orgs.some((org: { login: string }) => allowedOrgs.includes(org.login))
197+
) {
196198
authLogger.info(
197199
'User has an org in the allowed orgs list:',
198200
profile.login,

src/app/page.tsx

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -124,35 +124,42 @@ const Home = () => {
124124
aria-describedby="orgs table"
125125
aria-labelledby="orgs table"
126126
data={orgsPaginationSet}
127-
columns={[
128-
{
129-
header: 'Organization',
130-
rowHeader: true,
131-
field: 'login',
132-
sortBy: 'alphanumeric',
133-
renderCell: (row) => {
134-
return (
135-
<Stack direction="horizontal" align="center">
136-
<Stack.Item>
137-
<Avatar src={row.avatar_url} size={32} square={true} />
138-
</Stack.Item>
139-
<Stack.Item>
140-
<Link
141-
sx={{
142-
paddingRight: '5px',
143-
fontWeight: 'bold',
144-
fontSize: 2,
145-
}}
146-
href={`/${row.login}`}
147-
>
148-
{row.login}
149-
</Link>
150-
</Stack.Item>
151-
</Stack>
152-
)
127+
// `satisfies` cannot be used here — under moduleResolution:"bundler", DataTable's generic Data
128+
// param isn't inferred from data prop, so `field` only accepts "id". `as any` is the only
129+
// workaround until @primer/react fixes DataTable generic inference (draft component).
130+
columns={
131+
[
132+
{
133+
header: 'Organization',
134+
rowHeader: true,
135+
field: 'login',
136+
sortBy: 'alphanumeric',
137+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
138+
renderCell: (row: any) => {
139+
return (
140+
<Stack direction="horizontal" align="center">
141+
<Stack.Item>
142+
<Avatar src={row.avatar_url} size={32} square={true} />
143+
</Stack.Item>
144+
<Stack.Item>
145+
<Link
146+
sx={{
147+
paddingRight: '5px',
148+
fontWeight: 'bold',
149+
fontSize: 2,
150+
}}
151+
href={`/${row.login}`}
152+
>
153+
{row.login}
154+
</Link>
155+
</Stack.Item>
156+
</Stack>
157+
)
158+
},
153159
},
154-
},
155-
]}
160+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
161+
] as any
162+
}
156163
cellPadding="spacious"
157164
/>
158165
<Table.Pagination

src/bot/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Configuration } from '@probot/octokit-plugin-config/dist-types/types'
1+
import type { Configuration } from '@probot/octokit-plugin-config'
22
import z from 'zod'
33
import { logger } from '../utils/logger'
44
import { appOctokit, installationOctokit } from './octokit'

0 commit comments

Comments
 (0)