Skip to content

Commit 5cc5553

Browse files
Merge pull request #1399 from github/robertbrignull/skipped_private_repos
Show in log message when repos are filtered out for being private
2 parents b7489d8 + 3d74dbf commit 5cc5553

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

extensions/ql-vscode/src/remote-queries/run-remote-query.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ interface QueriesResponse {
3838
errors?: {
3939
invalid_repositories?: string[],
4040
repositories_without_database?: string[],
41+
private_repositories?: string[],
4142
},
4243
repositories_queried: string[],
4344
}
@@ -365,6 +366,10 @@ export function parseResponse(owner: string, repo: string, response: QueriesResp
365366
logMessage += `${eol2}Repositories without databases:${eol}${response.errors.repositories_without_database.join(', ')}`;
366367
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.`;
367368
}
369+
if (response.errors.private_repositories?.length) {
370+
logMessage += `${eol2}Non-public repositories:${eol}${response.errors.private_repositories.join(', ')}`;
371+
logMessage += `${eol}When using a public controller repository, only public repositories can be queried.`;
372+
}
368373
}
369374

370375
return {

extensions/ql-vscode/src/vscode-tests/no-workspace/remote-queries/run-remote-query.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,34 @@ describe('run-remote-query', () => {
7474
);
7575
});
7676

77+
it('should parse a response with private repos', () => {
78+
const result = parseResponse('org', 'name', {
79+
workflow_run_id: 123,
80+
repositories_queried: ['a/b', 'c/d'],
81+
errors: {
82+
private_repositories: ['e/f', 'g/h'],
83+
}
84+
});
85+
86+
expect(result.popupMessage).to.equal(
87+
['Successfully scheduled runs on 2 repositories. [Click here to see the progress](https://github.com/org/name/actions/runs/123).',
88+
'',
89+
'Some repositories could not be scheduled. See extension log for details.'].join(os.EOL)
90+
);
91+
expect(result.logMessage).to.equal(
92+
['Successfully scheduled runs on 2 repositories. See https://github.com/org/name/actions/runs/123.',
93+
'',
94+
'Repositories queried:',
95+
'a/b, c/d',
96+
'',
97+
'Some repositories could not be scheduled.',
98+
'',
99+
'Non-public repositories:',
100+
'e/f, g/h',
101+
'When using a public controller repository, only public repositories can be queried.'].join(os.EOL)
102+
);
103+
});
104+
77105
it('should parse a response with invalid repos and repos w/o databases', () => {
78106
const result = parseResponse('org', 'name', {
79107
workflow_run_id: 123,

0 commit comments

Comments
 (0)