@@ -91,42 +91,27 @@ export async function fetchReport(): Promise<AVM2Report | undefined> {
91
91
92
92
export async function getAVM1Progress ( ) : Promise < number > {
93
93
const octokit = new Octokit ( { authStrategy : createGithubAuth } ) ;
94
- const issue = await octokit . rest . issues . get ( {
94
+ const issues = await octokit . rest . issues . listForRepo ( {
95
95
owner : repository . owner ,
96
96
repo : repository . repo ,
97
- issue_number : 310 ,
97
+ labels : "avm1-tracking" ,
98
+ state : "all" ,
99
+ per_page : 65 ,
98
100
headers : {
99
101
accept : "application/vnd.github.html+json" ,
100
102
} ,
101
103
} ) ;
102
- const topLevelContent = issue . data . body_html ;
103
- if ( ! topLevelContent ) {
104
- return 0 ;
105
- }
106
- const topLevelRoot = parse ( topLevelContent ) ;
107
- let totalItems = topLevelRoot . querySelectorAll ( "input.task-list-item-checkbox" ) . length ;
108
- let completedItems = topLevelRoot . querySelectorAll ( "input.task-list-item-checkbox:checked" ) . length ;
109
- const linkedIssues = topLevelRoot . querySelectorAll ( `a[href^='https://github.com/${ repository . owner } /${ repository . repo } /issues/']` ) ;
110
- for ( let i = 0 ; i < linkedIssues . length ; i ++ ) {
111
- const issue = linkedIssues [ i ] ;
112
- const issue_href = issue . getAttribute ( "href" ) ;
113
- const issue_number = issue_href ? parseInt ( issue_href . replace ( `https://github.com/${ repository . owner } /${ repository . repo } /issues/` , '' ) ) : Number . NaN ;
114
- if ( ! Number . isNaN ( issue_number ) ) {
115
- const linkedIssue = await octokit . rest . issues . get ( {
116
- owner : repository . owner ,
117
- repo : repository . repo ,
118
- issue_number : issue_number ,
119
- headers : {
120
- accept : "application/vnd.github.html+json" ,
121
- } ,
122
- } ) ;
123
- const linkedContent = linkedIssue . data . body_html ;
124
- if ( linkedContent ) {
125
- const linkedRoot = parse ( linkedContent ) ;
126
- totalItems += linkedRoot . querySelectorAll ( "input.task-list-item-checkbox" ) . length ;
127
- completedItems += linkedRoot . querySelectorAll ( "input.task-list-item-checkbox:checked" ) . length ;
128
- }
104
+ let totalItems = 0 ;
105
+ let completedItems = 0 ;
106
+ for ( const issue of issues . data ) {
107
+ const topLevelContent = issue . body_html ;
108
+ if ( ! topLevelContent ) {
109
+ continue ;
129
110
}
111
+ const topLevelRoot = parse ( topLevelContent ) ;
112
+ totalItems += topLevelRoot . querySelectorAll ( "input.task-list-item-checkbox" ) . length ;
113
+ completedItems += topLevelRoot . querySelectorAll ( "input.task-list-item-checkbox:checked" ) . length ;
130
114
}
115
+ if ( totalItems < 3348 ) return 75 ;
131
116
return Math . round ( completedItems / totalItems * 100 ) ;
132
117
}
0 commit comments