File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Block PRs targeting wip branches (v2.1-wip, v3.0-wip) when they are
2+ # behind their parent branch (v2.0 and v2.1-wip respectively).
3+ # This prevents unpropagated commits from accumulating, which leads to
4+ # costly backports of many commits generating large conflicts.
5+ # See https://github.com/TransmodelEcosystem/NeTEx/issues/982
6+
7+ name : Check parent branch is up to date
8+
9+ on :
10+ pull_request :
11+ branches : [v2.1-wip, v3.0-wip]
12+
13+ jobs :
14+ parent-branch-is-up-to-date :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+ with :
19+ fetch-depth : 0
20+
21+ - name : Verify base branch contains all parent commits
22+ run : |
23+ case "${{ github.base_ref }}" in
24+ v2.1-wip) parent=v2.0 ;;
25+ v3.0-wip) parent=v2.1-wip ;;
26+ esac
27+
28+ behind=$(git rev-list --count "origin/${{ github.base_ref }}..origin/$parent")
29+ if [ "$behind" -gt 0 ]; then
30+ echo "::error::${{ github.base_ref }} is $behind commit(s) behind $parent. Merge $parent into ${{ github.base_ref }} first."
31+ git log --oneline "origin/${{ github.base_ref }}..origin/$parent"
32+ exit 1
33+ fi
You can’t perform that action at this time.
0 commit comments