Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ jobs:
ref: ${{ github.event.pull_request.base.ref }}

- name: Checkout the current pull request branch
run: git checkout ${{ github.event.pull_request.head.ref }}
run: |
git fetch --no-tags origin +refs/pull/${{ github.event.pull_request.number }}/head:${{ github.event.pull_request.head.ref }}
git checkout ${{ github.event.pull_request.head.ref }}

- name: Install dependencies
run: npm ci
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased [minor]

> Development of this release was supported by the [European Union](https://commission.europa.eu/).

### Added

- Add support for nested subgroups in Gitlab reporter repository paths

### Fixed

- Fix error logging in Gitlab reporter

## 4.1.0 - 2025-02-17

_Full changeset and discussions: [#1134](https://github.com/OpenTermsArchive/engine/pull/1134)._
Expand Down
15 changes: 6 additions & 9 deletions src/reporter/gitlab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ export default class GitLab {
static ISSUE_STATE_ALL = 'all';

constructor(repository, baseURL = BASE_URL, apiBaseURL = API_BASE_URL) {
const [ owner, repo ] = repository.split('/');

this.commonParams = { owner, repo };
this.repositoryPath = repository;
this.projectId = null;
this.baseURL = baseURL;
console.log('this.baseURL', this.baseURL);
Expand All @@ -31,9 +29,8 @@ export default class GitLab {
const options = GitLab.baseOptionsHttpReq();

try {
const repositoryPath = `${this.commonParams.owner}/${this.commonParams.repo}`;
const response = await nodeFetch(
`${this.apiBaseURL}/projects/${encodeURIComponent(repositoryPath)}`,
`${this.apiBaseURL}/projects/${encodeURIComponent(this.repositoryPath)}`,
options,
);

Expand All @@ -42,7 +39,7 @@ export default class GitLab {
if (response.ok) {
this.projectId = res.id;
} else {
logger.error(`Error while obtaining projectId: ${JSON.strinfigy(res)}`);
logger.error(`Error while obtaining projectId: ${JSON.stringify(res)}`);
this.projectId = null;
}
} catch (error) {
Expand Down Expand Up @@ -367,15 +364,15 @@ export default class GitLab {
}

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

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

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

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