From b5f8214b522639828f6bec7dda7de53168365635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20Barr=C3=A8re?= Date: Sat, 19 Sep 2026 13:13:29 +0200 Subject: [PATCH 1/2] v3.0-wip must be up-to-date from v2.0 now (in addition to v2.1-wip) --- .github/workflows/check-parent-branch.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/check-parent-branch.yml b/.github/workflows/check-parent-branch.yml index 3a432e6bd..f50d3b741 100644 --- a/.github/workflows/check-parent-branch.yml +++ b/.github/workflows/check-parent-branch.yml @@ -1,5 +1,5 @@ # Block PRs targeting wip branches (v2.1-wip, v3.0-wip) when they are -# behind their parent branch (v2.0 and v2.1-wip respectively). +# behind their parent branches (v2.0, and v2.1-wip + v2.0 respectively). # This prevents unpropagated commits from accumulating, which leads to # costly backports of many commits generating large conflicts. # See https://github.com/TransmodelEcosystem/NeTEx/issues/982 @@ -21,13 +21,15 @@ jobs: - name: Verify base branch contains all parent commits run: | case "${{ github.base_ref }}" in - v2.1-wip) parent=v2.0 ;; - v3.0-wip) parent=v2.1-wip ;; + v2.1-wip) parents="v2.0" ;; + v3.0-wip) parents="v2.1-wip v2.0" ;; esac - behind=$(git rev-list --count "origin/${{ github.base_ref }}..origin/$parent") - if [ "$behind" -gt 0 ]; then - echo "::error::${{ github.base_ref }} is $behind commit(s) behind $parent. Merge $parent into ${{ github.base_ref }} first." - git log --oneline "origin/${{ github.base_ref }}..origin/$parent" - exit 1 - fi + for parent in $parents; do + behind=$(git rev-list --count "origin/${{ github.base_ref }}..origin/$parent") + if [ "$behind" -gt 0 ]; then + echo "::error::${{ github.base_ref }} is $behind commit(s) behind $parent. Merge $parent into ${{ github.base_ref }} first." + git log --oneline "origin/${{ github.base_ref }}..origin/$parent" + exit 1 + fi + done From d650c6a27c52b3fb736dfc9938529019e79d424f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20Barr=C3=A8re?= Date: Sat, 19 Sep 2026 13:58:17 +0200 Subject: [PATCH 2/2] Make sure backport branches are not blocked Before: only the target branch was compared to its parent, so backport PRs were blocked too (see #1076). After: commits brought in by the PR itself are included in the comparison. --- .github/workflows/check-parent-branch.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-parent-branch.yml b/.github/workflows/check-parent-branch.yml index f50d3b741..2ad310590 100644 --- a/.github/workflows/check-parent-branch.yml +++ b/.github/workflows/check-parent-branch.yml @@ -25,11 +25,19 @@ jobs: v3.0-wip) parents="v2.1-wip v2.0" ;; esac + target="origin/${{ github.base_ref }}" + pr="${{ github.event.pull_request.head.sha }}" + + # Count the commits of the target's parent branch (e.g. v2.0 for + # v2.1-wip) found neither in the target branch nor in this PR. An + # ordinary PR does not bring them in, so it stays blocked while the + # target lags behind. A backport PR does, so it is not blocked by + # the very lag it fixes. for parent in $parents; do - behind=$(git rev-list --count "origin/${{ github.base_ref }}..origin/$parent") + behind=$(git rev-list --count "origin/$parent" --not "$target" "$pr") if [ "$behind" -gt 0 ]; then echo "::error::${{ github.base_ref }} is $behind commit(s) behind $parent. Merge $parent into ${{ github.base_ref }} first." - git log --oneline "origin/${{ github.base_ref }}..origin/$parent" + git log --oneline "origin/$parent" --not "$target" "$pr" exit 1 fi done