Copilot commented on code in PR #15369:
URL: https://github.com/apache/grails-core/pull/15369#discussion_r2750426599
##########
.github/workflows/publish-docs.yml:
##########
@@ -70,7 +60,7 @@ jobs:
with:
develocity-access-key: ${{ secrets.GRAILS_DEVELOCITY_ACCESS_KEY }}
- name: "📖 Generate Documentation"
- run: ./gradlew grails-doc:build -PgithubBranch=${TARGET_BRANCH}
+ run: ./gradlew grails-doc:build -PgithubBranch=${REF}
Review Comment:
`-PgithubBranch=${REF}` changes semantics from the previous `TARGET_BRANCH`
input. In `grails-doc/build.gradle`, `githubBranch` is used to form GitHub
*edit* URLs (e.g.,
`https://github.com/apache/grails-core/edit/$githubBranch/...`), and passing a
tag ref name will produce edit links pointing at a tag (often read-only / not
the intended maintenance branch). Consider restoring a separate target-branch
value (input or derived from the tag, e.g., `7.0.x`) and keep `REF`/tag only
for checkout/versioning.
##########
.github/workflows/publish-docs.yml:
##########
@@ -40,7 +30,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: "📝 Establish release version"
- run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV"
+ run: echo "VERSION=${REF#v}" >> "$GITHUB_ENV"
Review Comment:
`VERSION=${REF#v}` assumes the workflow is dispatched from a `v*` tag; if
the workflow is run from a branch (the workflow_dispatch UI allows this),
VERSION will be wrong (e.g., `main`) and the job may publish docs under an
unintended version. Add an explicit guard that fails early unless `github.ref`
is a tag (and optionally matches `refs/tags/v*`).
```suggestion
run: |
if [[ "${GITHUB_REF}" != refs/tags/v* ]]; then
echo "Error: This workflow must be run from a v* tag. Current
ref: ${GITHUB_REF}" >&2
exit 1
fi
echo "VERSION=${REF#v}" >> "$GITHUB_ENV"
```
--
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]