diff --git a/client-templates/gitlab/accept.json.sample b/client-templates/gitlab/accept.json.sample index 22e7105ee..a06829858 100644 --- a/client-templates/gitlab/accept.json.sample +++ b/client-templates/gitlab/accept.json.sample @@ -1581,6 +1581,12 @@ "method": "GET", "path": "/api/v4/personal_access_tokens/self", "origin": "https://${GITLAB}" - } + }, + { + "//": "get single pull request info", + "method": "GET", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + "origin": "https://${GITLAB}" + } ] } diff --git a/defaultFilters/gitlab.json b/defaultFilters/gitlab.json index a1c41c04e..112859c2a 100644 --- a/defaultFilters/gitlab.json +++ b/defaultFilters/gitlab.json @@ -1581,6 +1581,12 @@ "method": "GET", "path": "/api/v4/personal_access_tokens/self", "origin": "https://${GITLAB}" + }, + { + "//": "get single pull request info", + "method": "GET", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + "origin": "https://${GITLAB}" } ] } \ No newline at end of file diff --git a/test/unit/__snapshots__/runtime-rules-hotloading.test.ts.snap b/test/unit/__snapshots__/runtime-rules-hotloading.test.ts.snap index bbb51b7d2..732385a6b 100644 --- a/test/unit/__snapshots__/runtime-rules-hotloading.test.ts.snap +++ b/test/unit/__snapshots__/runtime-rules-hotloading.test.ts.snap @@ -7606,6 +7606,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, Object { "//": "used to get custom pull request template", "method": "GET", @@ -16187,6 +16193,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, Object { "//": "list the group's members", "method": "GET", @@ -24058,6 +24070,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, ], "public": Array [ Object { @@ -32016,6 +32034,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, Object { "//": "allow info refs (for git clone)", "method": "GET", @@ -40062,6 +40086,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, Object { "//": "used to scan IAC files", "method": "GET", @@ -48050,6 +48080,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, Object { "//": "allow info refs (for git clone)", "method": "GET", @@ -62647,6 +62683,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, Object { "//": "used to scan IAC files", "method": "GET", @@ -64292,6 +64334,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, Object { "//": "used to scan IAC files", "method": "GET", @@ -72145,6 +72193,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, ], "public": Array [ Object { @@ -79974,6 +80028,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, ], "public": Array [ Object { @@ -87803,6 +87863,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, ], "public": Array [ Object { @@ -95632,6 +95698,12 @@ Object { "origin": "https://\${GITLAB}", "path": "/api/v4/personal_access_tokens/self", }, + Object { + "//": "get single pull request info", + "method": "GET", + "origin": "https://\${GITLAB}", + "path": "/api/v4/projects/:project/merge_requests/:pullRef", + }, ], "public": Array [ Object { diff --git a/test/unit/filters.test.ts b/test/unit/filters.test.ts index 980942152..e038b5dd5 100644 --- a/test/unit/filters.test.ts +++ b/test/unit/filters.test.ts @@ -279,6 +279,18 @@ describe('filters', () => { const filterResponseUrl = filterResponse ? filterResponse.url : ''; expect(filterResponseUrl).toMatch(url); }); + + it('should allow fetching PR info', () => { + const url = '/api/v4/projects/test-project/merge_requests/1'; + + const filterResponse = filter({ + url, + method: 'GET', + }); + expect(filterResponse).not.toEqual(false); + const filterResponseUrl = filterResponse ? filterResponse.url : ''; + expect(filterResponseUrl).toMatch(url); + }); }); });