Skip to content

Commit 51558ec

Browse files
committed
debug: verify token scopes and latest event in CI
1 parent bdee942 commit 51558ec

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,27 @@ const main = async () => {
125125
const days = Math.max(1, Math.min(30, Number(DAYS || 14)));
126126
const fromDate = new Date(Date.now() - days * 24 * 60 * 60 * 1000);
127127

128+
// Debug: verify token type
129+
const tokenCheck = await fetch(
130+
'https://api.github.com/users/liby/events?per_page=1',
131+
{
132+
headers: {
133+
authorization: `bearer ${GH_TOKEN}`,
134+
accept: 'application/vnd.github.v3+json',
135+
},
136+
},
137+
);
138+
console.log(`Token scopes: ${tokenCheck.headers.get('x-oauth-scopes')}`);
139+
console.log(
140+
`Rate limit: ${tokenCheck.headers.get('x-ratelimit-limit')}`,
141+
);
142+
const tokenCheckData = (await tokenCheck.json()) as Array<{
143+
created_at: string;
144+
}>;
145+
if (tokenCheckData.length > 0) {
146+
console.log(`Latest event: ${tokenCheckData[0].created_at}`);
147+
}
148+
128149
console.log(`Username: ${username}`);
129150
console.log(`Fetching data for the last ${days} days`);
130151

0 commit comments

Comments
 (0)