only remove breaking-change label when there are schema changes (#2371)

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
Alex Goodman 2023-11-28 17:59:04 -05:00 committed by GitHub
parent a50a0f77d2
commit c379d21e9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 88 additions and 5 deletions

View File

@ -1,2 +1,78 @@
enforce-v0: true # don't make breaking-change label bump major version before 1.0. enforce-v0: true # don't make breaking-change label bump major version before 1.0.
title: "" 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: []

View File

@ -8,6 +8,12 @@ import re
DRY_RUN = False 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): def main(changed_files: str | None = None, merge_base_schema_files: str | None = None):
global DRY_RUN 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 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: if new_schema_files or removed_or_modified_schema_files:
print("\nAdding json-schema label...") print("\nAdding json-schema label...")
add_label(pr_number, "json-schema") add_label(pr_number, JSON_SCHEMA_LABEL)
else: 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 # 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... # 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]): if is_breaking_change(new_schema_files, og_json_schema_files[-1]):
print("\nBreaking change detected...") print("\nBreaking change detected...")
add_label(pr_number, "breaking-change") add_label(pr_number, BREAKING_CHANGE_LABEL)
else: 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... # 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... # removing schema files should never be allowed, we should warn about it on the PR via a comment...