From c379d21e9ae825f5360972e5c1e85ad4c9fe7b03 Mon Sep 17 00:00:00 2001 From: Alex Goodman Date: Tue, 28 Nov 2023 17:59:04 -0500 Subject: [PATCH] only remove breaking-change label when there are schema changes (#2371) Signed-off-by: Alex Goodman --- .chronicle.yaml | 78 ++++++++++++++++++- .github/scripts/labeler.py | 15 +++- ...abeler.yaml => detect-schema-changes.yaml} | 0 3 files changed, 88 insertions(+), 5 deletions(-) rename .github/workflows/{labeler.yaml => detect-schema-changes.yaml} (100%) diff --git a/.chronicle.yaml b/.chronicle.yaml index b74726c4143..58ba668f691 100644 --- a/.chronicle.yaml +++ b/.chronicle.yaml @@ -1,2 +1,78 @@ enforce-v0: true # don't make breaking-change label bump major version before 1.0. -title: "" \ No newline at end of file +title: "" + +github: + host: github.com + include-issue-pr-authors: true + include-issue-prs: true + include-issues-not-planned: false + include-prs: true + include-issues: true + include-unlabeled-issues: true + include-unlabeled-prs: true + issues-require-linked-prs: false + consider-pr-merge-commits: true + + exclude-labels: + - duplicate + - question + - invalid + - wontfix + - wont-fix + - release-ignore + - changelog-ignore + - ignore + + changes: + + - name: security-fixes + title: Security Fixes + semver-field: patch + labels: + - security + - vulnerability + + - name: added-feature + title: Added Features + semver-field: minor + labels: + - enhancement + - feature + - minor + + - name: bug-fix + title: Bug Fixes + semver-field: patch + labels: + - bug + - fix + - bug-fix + - patch + + - name: breaking-feature + title: Breaking Changes + semver-field: major + labels: + - breaking + - backwards-incompatible + - breaking-change + - breaking-feature + - major + - detected-breaking-change + + - name: removed-feature + title: Removed Features + semver-field: major + labels: + - removed + + - name: deprecated-feature + title: Deprecated Features + semver-field: minor + labels: + - deprecated + + - name: unknown + title: Additional Changes + semver-field: "" + labels: [] diff --git a/.github/scripts/labeler.py b/.github/scripts/labeler.py index 7ddeee7b895..21f1e3c15b0 100644 --- a/.github/scripts/labeler.py +++ b/.github/scripts/labeler.py @@ -8,6 +8,12 @@ DRY_RUN = False +JSON_SCHEMA_LABEL = "json-schema" + +# note: we can't use "breaking-change" as the label since that might be applied manually by a user. This is a +# distinct label that we can use to indicate that the label was applied (or removed) by automation. +BREAKING_CHANGE_LABEL = "detected-breaking-change" + def main(changed_files: str | None = None, merge_base_schema_files: str | None = None): global DRY_RUN @@ -67,17 +73,18 @@ def main(changed_files: str | None = None, merge_base_schema_files: str | None = # if there is a new or modified schema, we should add the "json-schema" label to the PR... if new_schema_files or removed_or_modified_schema_files: print("\nAdding json-schema label...") - add_label(pr_number, "json-schema") + add_label(pr_number, JSON_SCHEMA_LABEL) + else: - remove_label(pr_number, "json-schema") + remove_label(pr_number, JSON_SCHEMA_LABEL) # new schema files should be scrutinized, comparing the latest and added versions to see if it's a breaking # change (major version bump). Warn about it on the PR via adding a breaking-change label... if is_breaking_change(new_schema_files, og_json_schema_files[-1]): print("\nBreaking change detected...") - add_label(pr_number, "breaking-change") + add_label(pr_number, BREAKING_CHANGE_LABEL) else: - remove_label(pr_number, "breaking-change") + remove_label(pr_number, BREAKING_CHANGE_LABEL) # modifying an existing schema could be a breaking change, we should warn about it on the PR via a comment... # removing schema files should never be allowed, we should warn about it on the PR via a comment... diff --git a/.github/workflows/labeler.yaml b/.github/workflows/detect-schema-changes.yaml similarity index 100% rename from .github/workflows/labeler.yaml rename to .github/workflows/detect-schema-changes.yaml