Skip to content

Commit 1281320

Browse files
authored
Fix Gitlab reporter for nested subgroups
1 parent 546802f commit 1281320

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/reporter/gitlab/index.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ export default class GitLab {
1818
static ISSUE_STATE_ALL = 'all';
1919

2020
constructor(repository, baseURL = BASE_URL, apiBaseURL = API_BASE_URL) {
21-
const [ owner, repo ] = repository.split('/');
22-
23-
this.commonParams = { owner, repo };
21+
this.repositoryPath = repository;
2422
this.projectId = null;
2523
this.baseURL = baseURL;
2624
console.log('this.baseURL', this.baseURL);
@@ -31,9 +29,8 @@ export default class GitLab {
3129
const options = GitLab.baseOptionsHttpReq();
3230

3331
try {
34-
const repositoryPath = `${this.commonParams.owner}/${this.commonParams.repo}`;
3532
const response = await nodeFetch(
36-
`${this.apiBaseURL}/projects/${encodeURIComponent(repositoryPath)}`,
33+
`${this.apiBaseURL}/projects/${encodeURIComponent(this.repositoryPath)}`,
3734
options,
3835
);
3936

@@ -367,15 +364,15 @@ export default class GitLab {
367364
}
368365

369366
generateDeclarationURL(serviceName) {
370-
return `${this.baseURL}/${this.commonParams.owner}/${this.commonParams.repo}/-/blob/main/declarations/${encodeURIComponent(serviceName)}.json`;
367+
return `${this.baseURL}/${this.repositoryPath}/-/blob/main/declarations/${encodeURIComponent(serviceName)}.json`;
371368
}
372369

373370
generateVersionURL(serviceName, termsType) {
374-
return `${this.baseURL}/${this.commonParams.owner}/${this.commonParams.repo}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(serviceName, termsType)}.md`;
371+
return `${this.baseURL}/${this.repositoryPath}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(serviceName, termsType)}.md`;
375372
}
376373

377374
generateSnapshotsBaseUrl(serviceName, termsType) {
378-
return `${this.baseURL}/${this.commonParams.owner}/${this.commonParams.repo}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(termsType)}`;
375+
return `${this.baseURL}/${this.repositoryPath}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(termsType)}`;
379376
}
380377

381378
// GitLab API responses are not cached unlike GitHub, so this method only exists to satisfy the Reporter interface contract

0 commit comments

Comments
 (0)