This is an automated email from the ASF dual-hosted git repository.
lukaszlenart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/struts.git
The following commit(s) were added to refs/heads/main by this push:
new 7411024c9 build(ci): report the required check when only .claude/
changed (#1849)
7411024c9 is described below
commit 7411024c999ffb2b94898a6f11fcf448669544f7
Author: Lukasz Lenart <[email protected]>
AuthorDate: Fri Aug 14 18:55:29 2026 +0200
build(ci): report the required check when only .claude/ changed (#1849)
#1846 gated the maven.yml build job with a job-level `if:` on the
`changes` output, on the reasoning that a job skipped that way still
reports its check as "skipped", which required status checks accept.
That holds for a plain job, but not for a matrix one. A matrix job whose
condition is false is skipped before the matrix expands, so it emits a
single check run named after the raw name template rather than one per
matrix entry. On #1848 the reported name was literally
Build and Test (JDK ${{ matrix.java }})${{ ... }}
while .asf.yaml requires the context "Build and Test (JDK 17)". That
context never appeared, so it stayed Pending and the pull request could
not be merged - exactly the failure mode #1846 set out to avoid.
Drop the job-level condition and gate the four steps instead. The matrix
expands, all five checks report success under their expanded names, and
no Maven build runs: a .claude-only pull request costs five idle runners
for a few seconds instead of five full builds.
Jenkins is unaffected - stage-level `when` has no matrix to expand.
Co-authored-by: Claude Opus 5 <[email protected]>
---
.github/workflows/maven.yml | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 6d1e86112..891530f24 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -19,8 +19,8 @@ on:
# Deliberately NOT filtered by path. "Build and Test (JDK 17)" is a required
# status check in .asf.yaml, and a workflow skipped by path filtering never
# reports its checks - they stay Pending and the pull request can never be
- # merged. The build job is skipped by condition instead (see `changes`
below),
- # which does report, as "skipped", and satisfies the requirement.
+ # merged. The build job always runs instead, and its steps are skipped by
+ # condition when only .claude/ changed (see `changes` below).
pull_request:
push:
branches:
@@ -77,7 +77,12 @@ jobs:
build:
name: Build and Test (JDK ${{ matrix.java }})${{ matrix.profile ==
'-Pjakartaee11' && ' (Jakarta EE 11 + Spring 7)' || matrix.profile }}
needs: changes
- if: needs.changes.outputs.code == 'true'
+ # No job-level `if:` here on purpose. A matrix job whose condition is false
+ # is skipped *before* the matrix expands, so it reports a single check run
+ # named after the raw `${{ matrix.* }}` template - never "Build and Test
+ # (JDK 17)". The required context then never reports at all and the pull
+ # request stays blocked. Gate the steps instead: the matrix expands, every
+ # expected check reports success, and nothing is built.
runs-on: ubuntu-latest
strategy:
fail-fast: false
@@ -95,20 +100,23 @@ jobs:
profile: '-Pjakartaee11'
steps:
- name: Checkout code
+ if: needs.changes.outputs.code == 'true'
uses: actions/checkout@v7
- name: Setup Java ${{ matrix.java }}
+ if: needs.changes.outputs.code == 'true'
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Maven Verify on Java ${{ matrix.java }}${{ matrix.profile ==
'-Pjakartaee11' && ' (Jakarta EE 11 + Spring 7)' || matrix.profile }}
+ if: needs.changes.outputs.code == 'true'
run: mvn -B -V -DskipAssembly verify ${{ matrix.profile }}
--no-transfer-progress
- name: Test Summary ${{ matrix.java }} ${{ matrix.profile }}
uses:
mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 #v6.4.2
continue-on-error: true
- if: always()
+ if: always() && needs.changes.outputs.code == 'true'
with:
annotate_only: true # forked repo cannot write to checks so just do
annotations
report_paths: |