[backport] ci(github): fix branch glob to actually match release branches#2402
[backport] ci(github): fix branch glob to actually match release branches#2402acelyc111 wants to merge 1 commit into
Conversation
Backport of apache#2401 to v2.5. The branch filter pattern 'v[0-9]+.*' uses GitHub Actions' glob syntax (not regex), where '+' is a literal character and '[0-9]' matches a single digit. As a result, this pattern never matches release branches like 'v2.5' or 'v2.5.1', so PRs targeting v2.5 silently skip every workflow that has this filter. For example, PR apache#2394 (targeting v2.5) only triggered the Go/Labeler workflows that have no branches filter, while Cpp CI and other language CIs were silently skipped. 'gh run list --workflow lint_and_test_cpp.yaml --branch v2.5' returns no runs at all, confirming the filter has never matched on this branch. Replace the broken pattern with 'v[0-9]*', which matches any branch starting with 'v' followed by a digit (v2.5, v2.5.1, v10.20, etc.). Apply the same fix to all 14 workflows that use this pattern on v2.5.
Closing — original diagnosis was wrongAfter deeper investigation, the premise of this PR is incorrect: 1. 2. The reason 3. The actual root cause of
This is exactly what #2398 fixed on master (pinning every action to a SHA from the ASF allow-list, plus restructuring some workflows to use local composite actions). Correct fixI'll open a new PR targeting v2.5 that backports #2398-style SHA pinning of all third-party actions. Sorry for the noise. |
Summary
Backport of #2401 to
v2.5.The branch filter
'v[0-9]+.*'used in workflow files never matches thev2.5branch, because GitHub Actions branch filters use glob syntax (not regex):+is a literal character, not a quantifier[0-9]matches exactly one digit, not "one or more"As a result, PRs targeting
v2.5silently skip every workflow that has this filter, while only those withoutbranches:filters (e.g., the Golang/Labeler ones) actually run.Evidence
PR #2394 targets
v2.5and modifiessrc/replica/duplication/**(C++ code):Golang Lint and Unit Test - admin-cli/pegic,Module Labeler(nobranchesfilter)Cpp CI,Lint and Test - admin-cli(cli proper),Lint and Test - go-client, etc.Confirmed historically:
Cpp CIhas never run on thev2.5branch since the workflow was added.Fix
Replace
'v[0-9]+.*'with'v[0-9]*', which is valid GitHub Actions glob syntax and matchesv2.5,v2.5.1,v10.20, etc. Applied uniformly to all 14 affected workflows onv2.5(mechanical sed replacement, one-line change per file).Self-validating
This PR modifies
.github/workflows/lint_and_test_cpp.yaml, which matchesCpp CI's ownpaths:filter. Combined with the branch glob fix onv2.5, this PR itself should be the first timeCpp CIever runs on av2.5PR — providing direct, in-band proof that the fix works.Verification
yaml.safe_load)Cpp CIactually appears in the checks list (proof the fix works)