Show skipped private repos in log message
This commit is contained in:
@@ -38,6 +38,7 @@ interface QueriesResponse {
|
||||
errors?: {
|
||||
invalid_repositories?: string[],
|
||||
repositories_without_database?: string[],
|
||||
private_repositories?: string[],
|
||||
},
|
||||
repositories_queried: string[],
|
||||
}
|
||||
@@ -361,6 +362,10 @@ export function parseResponse(owner: string, repo: string, response: QueriesResp
|
||||
logMessage += `${eol2}Repositories without databases:${eol}${response.errors.repositories_without_database.join(', ')}`;
|
||||
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.`;
|
||||
}
|
||||
if (response.errors.private_repositories?.length) {
|
||||
logMessage += `${eol2}Non-public repositories:${eol}${response.errors.private_repositories.join(', ')}`;
|
||||
logMessage += `${eol}When using a public controller repository, only public repositories can be queried.`;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -74,6 +74,34 @@ describe('run-remote-query', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse a response with private repos', () => {
|
||||
const result = parseResponse('org', 'name', {
|
||||
workflow_run_id: 123,
|
||||
repositories_queried: ['a/b', 'c/d'],
|
||||
errors: {
|
||||
private_repositories: ['e/f', 'g/h'],
|
||||
}
|
||||
});
|
||||
|
||||
expect(result.popupMessage).to.equal(
|
||||
['Successfully scheduled runs on 2 repositories. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
|
||||
'',
|
||||
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
|
||||
);
|
||||
expect(result.logMessage).to.equal(
|
||||
['Successfully scheduled runs on 2 repositories. See https://github.com/org/name/actions/runs/123.',
|
||||
'',
|
||||
'Repositories queried:',
|
||||
'a/b, c/d',
|
||||
'',
|
||||
'Some repositories could not be scheduled.',
|
||||
'',
|
||||
'Non-public repositories:',
|
||||
'e/f, g/h',
|
||||
'When using a public controller repository, only public repositories can be queried'].join(os.EOL)
|
||||
);
|
||||
});
|
||||
|
||||
it('should parse a response with invalid repos and repos w/o databases', () => {
|
||||
const result = parseResponse('org', 'name', {
|
||||
workflow_run_id: 123,
|
||||
|
||||
Reference in New Issue
Block a user