You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constpopupMessage=`Successfully scheduled runs on ${numRepositoriesQueried} repositories. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}).`
364
+
constpopupMessage=`Successfully scheduled runs on ${pluralizeRepositories(numRepositoriesQueried)}. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}).`
358
365
+(response.errors ? `${eol2}Some repositories could not be scheduled. See extension log for details.` : '');
359
366
360
-
letlogMessage=`Successfully scheduled runs on ${numRepositoriesQueried} repositories. See https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}.`;
367
+
letlogMessage=`Successfully scheduled runs on ${pluralizeRepositories(numRepositoriesQueried)}. See https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}.`;
logMessage+=`${eol2}Some repositories could not be scheduled.`;
365
372
if(invalid_repositories?.length){
366
-
logMessage+=`${eol2}${invalid_repositories.length} repositories were invalid and could not be found:${eol}${invalid_repositories.join(', ')}`;
373
+
logMessage+=`${eol2}${pluralizeRepositories(invalid_repositories.length)} invalid and could not be found:${eol}${invalid_repositories.join(', ')}`;
367
374
}
368
375
if(repositories_without_database?.length){
369
-
logMessage+=`${eol2}${repositories_without_database.length} repositories did not have a CodeQL database available:${eol}${repositories_without_database.join(', ')}`;
376
+
logMessage+=`${eol2}${pluralizeRepositories(repositories_without_database.length)} did not have a CodeQL database available:${eol}${repositories_without_database.join(', ')}`;
370
377
logMessage+=`${eol}For each public repository that has not yet been added to the database service, we will try to create a database next time the store is updated.`;
371
378
}
372
379
if(private_repositories?.length){
373
-
logMessage+=`${eol2}${private_repositories.length} repositories are not public:${eol}${private_repositories.join(', ')}`;
380
+
logMessage+=`${eol2}${pluralizeRepositories(private_repositories.length)} not public:${eol}${private_repositories.join(', ')}`;
374
381
logMessage+=`${eol}When using a public controller repository, only public repositories can be queried.`;
375
382
}
376
383
if(cutoff_repositories_count){
377
-
logMessage+=`${eol2}${cutoff_repositories_count} repositories over the limit for a single request`;
384
+
logMessage+=`${eol2}${pluralizeRepositories(cutoff_repositories_count)} over the limit for a single request`;
'2 repositories were invalid and could not be found:',
184
+
'2 repositories invalid and could not be found:',
185
185
'e/f, g/h',
186
186
'',
187
187
'2 repositories did not have a CodeQL database available:',
188
188
'i/j, k/l',
189
189
'For each public repository that has not yet been added to the database service, we will try to create a database next time the store is updated.'].join(os.EOL)
190
190
);
191
191
});
192
+
193
+
it('should parse a response with one repo of each category, and not pluralize "repositories"',()=>{
194
+
constresult=parseResponse('org','name',{
195
+
workflow_run_id: 123,
196
+
repositories_queried: ['a/b'],
197
+
errors: {
198
+
private_repositories: ['e/f'],
199
+
cutoff_repositories: ['i/j'],
200
+
cutoff_repositories_count: 1,
201
+
invalid_repositories: ['m/n'],
202
+
repositories_without_database: ['q/r'],
203
+
}
204
+
});
205
+
206
+
expect(result.popupMessage).to.equal(
207
+
['Successfully scheduled runs on 1 repository. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
208
+
'',
209
+
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
210
+
);
211
+
expect(result.logMessage).to.equal(
212
+
[
213
+
'Successfully scheduled runs on 1 repository. See https://github.com/org/name/actions/runs/123.',
214
+
'',
215
+
'Repositories queried:',
216
+
'a/b',
217
+
'',
218
+
'Some repositories could not be scheduled.',
219
+
'',
220
+
'1 repository invalid and could not be found:',
221
+
'm/n',
222
+
'',
223
+
'1 repository did not have a CodeQL database available:',
224
+
'q/r',
225
+
'For each public repository that has not yet been added to the database service, we will try to create a database next time the store is updated.',
226
+
'',
227
+
'1 repository not public:',
228
+
'e/f',
229
+
'When using a public controller repository, only public repositories can be queried.',
230
+
'',
231
+
'1 repository over the limit for a single request:',
232
+
'i/j',
233
+
'Repositories were selected based on how recently they had been updated.',
0 commit comments