diff --git a/ng-dev/caretaker/check/github.spec.ts b/ng-dev/caretaker/check/github.spec.ts index 151730d27..72294e1d2 100644 --- a/ng-dev/caretaker/check/github.spec.ts +++ b/ng-dev/caretaker/check/github.spec.ts @@ -54,19 +54,34 @@ describe('GithubQueriesModule', () => { issueCount: 1, nodes: [{url: 'http://github.com/owner/name/issue/1'}], }, + 'query_with_colon': { + issueCount: 0, + nodes: [], + }, }); const module = new GithubQueriesModule(git, { ...mockNgDevConfig, - caretaker: {githubQueries: [{name: 'key name with spaces', query: 'issue: yes'}]}, + caretaker: { + githubQueries: [ + {name: 'key name with spaces', query: 'issue: yes'}, + {name: 'query_with_colon', query: 'is:milestone'}, + ], + }, }); expect(await module.data).toEqual([ { queryName: 'key name with spaces', count: 1, - queryUrl: 'https://github.com/owner/name/issues?q=issue:%20yes', + queryUrl: 'https://github.com/owner/name/issues?q=issue%3A%20yes', matchedUrls: ['http://github.com/owner/name/issue/1'], }, + { + queryName: 'query_with_colon', + count: 0, + queryUrl: 'https://github.com/owner/name/issues?q=is%3Amilestone', + matchedUrls: [], + }, ]); }); }); diff --git a/ng-dev/caretaker/check/github.ts b/ng-dev/caretaker/check/github.ts index 361b430fa..76b15bb91 100644 --- a/ng-dev/caretaker/check/github.ts +++ b/ng-dev/caretaker/check/github.ts @@ -66,10 +66,13 @@ export class GithubQueriesModule extends BaseModule { const {owner, name: repo} = this.git.remoteConfig; return results.map((result, i) => { + const query = queries[i]; + const queryURLParam = encodeURIComponent(query.query); + return { - queryName: queries[i].name, + queryName: query.name, count: result.issueCount, - queryUrl: encodeURI(`https://github.com/${owner}/${repo}/issues?q=${queries[i].query}`), + queryUrl: `https://github.com/${owner}/${repo}/issues?q=${queryURLParam}`, matchedUrls: result.nodes.map((node) => node.url), }; });