Skip to content

Apache DataFusion SQL Query Engine

ci: add `auto detected api change` label on breaking change detecting in the CI (#21953)

Raz Luvatonfa9ada368710
diff --git a/.github/workflows/breaking_changes_detector_comment.yml b/.github/workflows/breaking_changes_detector_comment.yml
index 8e79426082..579c61cb9d 100644
--- a/.github/workflows/breaking_changes_detector_comment.yml
+++ b/.github/workflows/breaking_changes_detector_comment.yml
@@ -50,6 +50,13 @@ on:
permissions:
contents: read
+# A dedicated label, separate from the existing `api change` label.
+# `api change` may be applied manually for behavioral changes that aren't
+# strictly API changes, so we can't safely auto-remove it when this check
+# passes. This auto-managed label is fully owned by the workflow.
+env:
+ BREAKING_CHANGE_LABEL: "auto detected api change"
+
jobs:
comment-on-pr:
name: Comment on pull request
@@ -130,3 +137,24 @@ jobs:
number: ${{ steps.read.outputs.pr_number }}
body-include: '<!-- semver-check-comment -->'
delete: true
+
+ - name: Add "auto detected api change" label
+ if: steps.read.outputs.result != 'success'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ REPO: ${{ github.repository }}
+ PR_NUMBER: ${{ steps.read.outputs.pr_number }}
+ run: |
+ gh pr edit "$PR_NUMBER" --repo "$REPO" \
+ --add-label "$BREAKING_CHANGE_LABEL"
+
+ - name: Remove "auto detected api change" label
+ if: steps.read.outputs.result == 'success'
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ REPO: ${{ github.repository }}
+ PR_NUMBER: ${{ steps.read.outputs.pr_number }}
+ run: |
+ # No-op when the label isn't currently applied.
+ gh pr edit "$PR_NUMBER" --repo "$REPO" \
+ --remove-label "$BREAKING_CHANGE_LABEL" || true
diff --git a/dev/release/generate-changelog.py b/dev/release/generate-changelog.py
index 830d329f73..7135043891 100755
--- a/dev/release/generate-changelog.py
+++ b/dev/release/generate-changelog.py
@@ -77,7 +77,7 @@ def generate_changelog(repo, repo_name, tag1, tag2, version):
cc_breaking = parts_tuple[2] == '!'
labels = [label.name for label in pull.labels]
- if 'api change' in labels or cc_breaking:
+ if 'api change' in labels or 'auto detected api change' in labels or cc_breaking:
breaking.append((pull, commit))
elif 'bug' in labels or cc_type == 'fix':
bugs.append((pull, commit))