Skip to content

Commit 595435a

Browse files
authored
Ensure labels are properly recreated after removing deprecated labels in GitHub and GitLab reporters (#1171)
2 parents db4a861 + 77b4bd8 commit 595435a

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
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).
44

5+
## Unreleased [patch]
6+
7+
> Development of this release was supported by the [French Ministry for Foreign Affairs](https://www.diplomatie.gouv.fr/fr/politique-etrangere-de-la-france/diplomatie-numerique/) through its ministerial [State Startups incubator](https://beta.gouv.fr/startups/open-terms-archive.html) under the aegis of the Ambassador for Digital Affairs.
8+
9+
### Fixed
10+
11+
- Ensure labels are properly recreated after removing deprecated labels in GitHub and GitLab reporters
12+
513
## 6.0.0 - 2025-07-01
614

715
_Full changeset and discussions: [#1170](https://github.com/OpenTermsArchive/engine/pull/1170)._

src/reporter/github/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ export default class GitHub {
6262
}
6363
}
6464

65-
const existingLabelsNames = existingLabels.map(label => label.name);
65+
const updatedExistingLabels = labelsToRemove.length ? await this.getRepositoryLabels() : existingLabels; // Refresh labels after deletion, only if needed
66+
const existingLabelsNames = updatedExistingLabels.map(label => label.name);
6667
const missingLabels = this.MANAGED_LABELS.filter(label => !existingLabelsNames.includes(label.name));
6768

6869
if (missingLabels.length) {

src/reporter/gitlab/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export default class GitLab {
5656
}
5757
}
5858

59-
const existingLabelsNames = existingLabels.map(label => label.name);
59+
const updatedExistingLabels = labelsToRemove.length ? await this.getRepositoryLabels() : existingLabels; // Refresh labels after deletion, only if needed
60+
const existingLabelsNames = updatedExistingLabels.map(label => label.name);
6061
const missingLabels = this.MANAGED_LABELS.filter(label => !existingLabelsNames.includes(label.name));
6162

6263
if (missingLabels.length) {

0 commit comments

Comments
 (0)