From 40e6290e62347063bd9be9db36e84186cad75ddf Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Thu, 16 Apr 2026 21:14:50 +0200 Subject: [PATCH] Scope backport-to-v3-2-test label to PRs targeting main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses the per-rule `targetBranchFilter` option added in kaxil/boring-cyborg#112 so the backport label is not applied to PRs opened directly against the v3-2-test maintenance branch — where a backport label is meaningless. Also teaches the `check-boring-cyborg-configuration` prek hook about the new `{paths, targetBranchFilter}` object form for label rules. --- .github/boring-cyborg.yml | 25 +++++++++++++++---------- scripts/ci/prek/boring_cyborg.py | 10 ++++++++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml index 2888b199edc7c..0916d328ea8ae 100644 --- a/.github/boring-cyborg.yml +++ b/.github/boring-cyborg.yml @@ -348,17 +348,22 @@ labelPRBasedOnFilePath: - .readthedocs.yml # This should be copy of the "area:dev-tools" above minus contributing docs and some files that should - # only make sense in main - it should be updated when we switch maintenance branch + # only make sense in main - it should be updated when we switch maintenance branch. + # Scoped to PRs targeting `main` only — a PR opened directly against v3-2-test + # does not need a backport-to-v3-2-test label. backport-to-v3-2-test: - - scripts/**/* - - dev/**/* - - .github/**/* - - Dockerfile.ci - - yamllint-config.yml - - .dockerignore - - .hadolint.yaml - - .pre-commit-config.yaml - - .rat-excludes + paths: + - scripts/**/* + - dev/**/* + - .github/**/* + - Dockerfile.ci + - yamllint-config.yml + - .dockerignore + - .hadolint.yaml + - .pre-commit-config.yaml + - .rat-excludes + targetBranchFilter: + - ^main$ kind:documentation: - airflow-core/docs/**/* diff --git a/scripts/ci/prek/boring_cyborg.py b/scripts/ci/prek/boring_cyborg.py index 4db81cc0d5c01..5e9ef359ffb7c 100755 --- a/scripts/ci/prek/boring_cyborg.py +++ b/scripts/ci/prek/boring_cyborg.py @@ -46,8 +46,14 @@ raise SystemExit(f"Missing section {CONFIG_KEY}") errors = [] -# Check if all patterns in the cyborg config are existing in the repository -for label, patterns in cyborg_config[CONFIG_KEY].items(): +# Each label rule is either a list of glob patterns (legacy form) or an object +# with `paths` and an optional `targetBranchFilter` (see kaxil/boring-cyborg#112). +# Only the glob patterns in `paths` need to exist in the repository. +for label, rule in cyborg_config[CONFIG_KEY].items(): + if isinstance(rule, dict): + patterns = rule.get("paths", []) + else: + patterns = rule for pattern in patterns: try: next(Path(AIRFLOW_ROOT_PATH).glob(pattern))