Skip to content

Commit

Permalink
only remove breaking-change label when there are schema changes (#2371)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman authored Nov 28, 2023
1 parent a50a0f7 commit c379d21
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 5 deletions.
78 changes: 77 additions & 1 deletion .chronicle.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,78 @@
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: []
15 changes: 11 additions & 4 deletions .github/scripts/labeler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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...
Expand Down
File renamed without changes.

0 comments on commit c379d21

Please sign in to comment.