@@ -17,10 +17,7 @@ import {
1717 validate ,
1818} from "./common/utils" ;
1919import { getRateLimit } from "./requests/getRateLimit" ;
20- import {
21- sendActionError ,
22- sendActionRun ,
23- } from "./analytics" ;
20+ import { sendActionError , sendActionRun } from "./analytics" ;
2421
2522async function main ( ) {
2623 try {
@@ -34,11 +31,17 @@ async function main() {
3431 ) ;
3532 return ;
3633 }
37- const rateLimitAtBeginning = await getRateLimit ( ) ;
38- console . log (
39- "RATE LIMIT REMAINING BEFORE REQUESTS: " ,
40- rateLimitAtBeginning . data . rate . remaining
41- ) ;
34+ try {
35+ const rateLimitAtBeginning = await getRateLimit ( ) ;
36+ console . log (
37+ "RATE LIMIT REMAINING BEFORE REQUESTS: " ,
38+ rateLimitAtBeginning . data . rate . remaining
39+ ) ;
40+ } catch ( error ) {
41+ console . log (
42+ "Rate limit could not be retrieved at the beginning of the action"
43+ ) ;
44+ }
4245
4346 const ownersRepos = getOwnersRepositories ( ) ;
4447 const organizationsRepos = await getOrganizationsRepositories ( ) ;
@@ -93,11 +96,15 @@ async function main() {
9396 console . log ( "Calculation complete. Generating markdown." ) ;
9497 await createOutput ( preparedData ) ;
9598
96- const rateLimitAtEnd = await getRateLimit ( ) ;
97- console . log (
98- "RATE LIMIT REMAINING AFTER REQUESTS: " ,
99- rateLimitAtEnd . data . rate . remaining
100- ) ;
99+ try {
100+ const rateLimitAtEnd = await getRateLimit ( ) ;
101+ console . log (
102+ "RATE LIMIT REMAINING AFTER REQUESTS: " ,
103+ rateLimitAtEnd . data . rate . remaining
104+ ) ;
105+ } catch ( error ) {
106+ console . log ( "Rate limit could not be retrieved at the end of the action" ) ;
107+ }
101108 } catch ( error ) {
102109 sendActionError ( error as Error ) ;
103110 throw error ;
0 commit comments