@@ -9,15 +9,18 @@ let octokit;
9
9
10
10
const orgName = "TBD54566975" ;
11
11
const repos = [
12
+ "tbdex" ,
12
13
"tbdex-js" ,
13
14
"tbdex-kt" ,
14
15
"tbdex-swift" ,
15
16
"tbdex-rs" ,
17
+ "web5-spec" ,
16
18
"web5-js" ,
17
19
"web5-kt" ,
18
20
"web5-swift" ,
19
21
"web5-rs" ,
20
- // "dwn-sdk-js",
22
+ "dwn-sdk-js" ,
23
+ "dwn-server" ,
21
24
] ;
22
25
23
26
const KNOWN_PAST_MEMBERS = [ "amika-sq" ] ;
@@ -26,7 +29,7 @@ const KNOWN_BOTS = ['codecov-commenter', 'dependabot[bot]', 'renovate[bot]'];
26
29
27
30
// Cache members to avoid rate limiting
28
31
const membersCache = new Map (
29
- KNOWN_PAST_MEMBERS . map ( ( kpm ) => [ kpm , true ] )
32
+ KNOWN_PAST_MEMBERS . map ( ( kpm ) => [ kpm , 'org' ] )
30
33
) ;
31
34
32
35
async function fetchIssues ( owner , repo ) {
@@ -93,8 +96,8 @@ async function isMember(org, user) {
93
96
94
97
if ( user . type === 'Bot' || KNOWN_BOTS . includes ( user . login ) ) {
95
98
console . info ( "Skipping bot" , user . login ) ;
96
- membersCache . set ( username , true ) ;
97
- return true ;
99
+ membersCache . set ( username , 'bot' ) ;
100
+ return 'bot' ;
98
101
}
99
102
100
103
try {
@@ -105,9 +108,9 @@ async function isMember(org, user) {
105
108
if ( res . status === 302 ) {
106
109
throw new Error ( "Forbidden to check membership!" ) ;
107
110
} else if ( res . status === 204 ) {
108
- membersCache . set ( username , true ) ;
111
+ membersCache . set ( username , 'org' ) ;
109
112
console . info ( "member found in org" , username ) ;
110
- return true ;
113
+ return 'org' ;
111
114
} else {
112
115
console . info ( "member not found in org" , username ) ;
113
116
membersCache . set ( username , false ) ;
@@ -134,12 +137,15 @@ async function aggregateData(owner, repo) {
134
137
console . info ( `Fetched ${ issues . length } issues, ${ prs . length } PRs, and ${ comments . length } comments for ${ owner } /${ repo } ` ) ;
135
138
136
139
const now = moment ( ) ;
137
- const beginningTime = now . clone ( ) . subtract ( 3 , 'months' ) ;
140
+ const beginningTime = now . clone ( ) . subtract ( 4 , 'months' ) ;
138
141
139
142
const monthlyData = {
140
143
issues : { } ,
144
+ internalMemberIssues : { } ,
141
145
prs : { } ,
142
- comments : { }
146
+ internalMemberPrs : { } ,
147
+ comments : { } ,
148
+ internalMemberComments : { } ,
143
149
} ;
144
150
145
151
function addToMonthlyData ( type , date ) {
@@ -151,7 +157,9 @@ async function aggregateData(owner, repo) {
151
157
console . info ( "Computing issues numbers..." ) ;
152
158
for ( const issue of issues ) {
153
159
const member = await isMember ( owner , issue . user ) ;
154
- if ( ! member && moment ( issue . created_at ) . isAfter ( beginningTime ) ) {
160
+ if ( member === 'org' ) {
161
+ addToMonthlyData ( 'internalMemberIssues' , issue . created_at ) ;
162
+ } else if ( member !== 'bot' ) {
155
163
addToMonthlyData ( 'issues' , issue . created_at ) ;
156
164
// print issue details with link
157
165
console . info ( `[${ issue . user . login } ]: ${ issue . title } (${ issue . html_url } )` ) ;
@@ -161,7 +169,9 @@ async function aggregateData(owner, repo) {
161
169
console . info ( "Computing PRs numbers..." ) ;
162
170
for ( const pr of prs ) {
163
171
const member = await isMember ( owner , pr . user ) ;
164
- if ( ! member && moment ( pr . created_at ) . isAfter ( beginningTime ) ) {
172
+ if ( member === 'org' ) {
173
+ addToMonthlyData ( 'internalMemberPrs' , pr . created_at ) ;
174
+ } else if ( member !== 'bot' ) {
165
175
addToMonthlyData ( 'prs' , pr . created_at ) ;
166
176
// print PR details with link
167
177
console . info ( `[${ pr . user . login } ]: ${ pr . title } (${ pr . html_url } )` ) ;
@@ -171,7 +181,9 @@ async function aggregateData(owner, repo) {
171
181
console . info ( "Computing comments numbers..." ) ;
172
182
for ( const comment of comments ) {
173
183
const member = await isMember ( owner , comment . user ) ;
174
- if ( ! member && moment ( comment . created_at ) . isAfter ( beginningTime ) ) {
184
+ if ( member === 'org' ) {
185
+ addToMonthlyData ( 'internalMemberComments' , comment . created_at ) ;
186
+ } else if ( member !== 'bot' ) {
175
187
addToMonthlyData ( 'comments' , comment . created_at ) ;
176
188
// print comment details with link
177
189
console . info ( `[${ comment . user . login } ]: ${ comment . body . substring ( 0 , 48 ) } ... (${ comment . html_url } )` ) ;
0 commit comments