This is an automated email from the ASF dual-hosted git repository.

ashishvijaywargiya pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3050ccf4aa Fixing the issue with the CI/CD (#1470)
3050ccf4aa is described below

commit 3050ccf4aa5cfcda819a5a76fae21b1a2ef96453
Author: Ashish Vijaywargiya <[email protected]>
AuthorDate: Mon Jul 20 17:10:55 2026 +0530

    Fixing the issue with the CI/CD (#1470)
    
    GitHub Actions doesn't expose the context to , so the
    release*-skips-JDK-21 condition broke workflow parsing entirely (0 jobs
    run); shrinking the matrix itself in a prep job avoids that restriction.
---
 .github/workflows/gradle.yml | 33 +++++++++++++++++++++++++++++----
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index fd68e2dd32..21cfd1411e 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -29,16 +29,41 @@ permissions:
   contents: read
 
 jobs:
+  # Computes which JDK versions the build job's matrix should cover. This 
lives in its
+  # own job because the `matrix` context is not available in a job-level 
`if:`, so the
+  # release*-branches-skip-21 rule can't be expressed as a condition on the 
build job
+  # itself - see https://github.com/orgs/community/discussions/37883. Instead 
we shrink
+  # the matrix itself before it reaches the build job.
+  prep:
+    runs-on: ubuntu-latest
+    outputs:
+      java: ${{ steps.set-matrix.outputs.java }}
+    steps:
+    - name: Determine JDK matrix
+      id: set-matrix
+      env:
+        EVENT_NAME: ${{ github.event_name }}
+        REF_NAME: ${{ github.ref_name }}
+        BASE_REF: ${{ github.base_ref }}
+      run: |
+        # release* branches stay JDK 17 only until they adopt JDK 21 too,
+        # since trunk fixes must stay backportable to them.
+        if { [ "$EVENT_NAME" = "push" ] && [[ "$REF_NAME" == release* ]]; } || 
\
+           { [ "$EVENT_NAME" = "pull_request" ] && [[ "$BASE_REF" == release* 
]]; }; then
+          echo 'java=[17]' >> "$GITHUB_OUTPUT"
+        else
+          echo 'java=[17,21]' >> "$GITHUB_OUTPUT"
+        fi
+
   build:
     # trunk builds sourceCompatibility/targetCompatibility 17 bytecode (see 
build.gradle),
     # but is matrix-tested on both the JDK 17 runtime it targets and the JDK 
21 runtime
-    # it may adopt later. release* branches stay JDK 17 only until they make 
that same move,
-    # since trunk fixes must stay backportable to them.
-    if: ${{ !(matrix.java == 21 && ((github.event_name == 'push' && 
startsWith(github.ref_name, 'release')) || (github.event_name == 'pull_request' 
&& startsWith(github.base_ref, 'release')))) }}
+    # it may adopt later.
+    needs: prep
     strategy:
       fail-fast: false
       matrix:
-        java: [ 17, 21 ]
+        java: ${{ fromJson(needs.prep.outputs.java) }}
 
     runs-on: ubuntu-latest
 

Reply via email to