Copilot commented on code in PR #15598:
URL: https://github.com/apache/grails-core/pull/15598#discussion_r3137061681


##########
.github/workflows/gradle.yml:
##########
@@ -398,10 +398,19 @@ jobs:
         if: success()
         run: |
           export GRAILS_WRAPPER_ALLOWED_TYPES='SNAPSHOT'
+          # Pin the wrapper to this branch's snapshot; otherwise it resolves 
the
+          # globally latest SNAPSHOT in the Apache repo (e.g. 8.0.0-SNAPSHOT 
from
+          # the main development branch), which may be compiled for a newer 
Java
+          # runtime than this job's JDK and fail with 
UnsupportedClassVersionError.
+          PROJECT_VERSION=$(grep '^projectVersion=' gradle.properties | cut 
-d'=' -f2)
           cp grails-wrapper/build/distributions/apache-grails-wrapper-*.zip 
build/wrapper.zip
           cd build
           unzip wrapper -d tmp
           mv tmp/apache-grails-wrapper-* tmp/wrapper
+          # The wrapper reads `grailsVersion` from gradle.properties in its CWD
+          # (see grails.init.GrailsVersion#getPreferredGrailsVersion) to select
+          # which Grails CLI snapshot to download.
+          echo "grailsVersion=${PROJECT_VERSION}" > gradle.properties

Review Comment:
   `cd build` + `unzip ... -d tmp` creates the extracted wrapper under 
`build/tmp/wrapper`, but the subsequent upload step uses `path: tmp/wrapper` 
(relative to the repo root). That path won’t exist, so the artifact upload will 
be empty (or fail, depending on `upload-artifact` settings). Consider either 
extracting to `${GITHUB_WORKSPACE}/tmp` or changing the upload path to 
`build/tmp/wrapper`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to