Use workflow_dispatch ref instead of manual inputs#15369
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the manual documentation publishing workflow to derive the release/tag information from the workflow_dispatch run ref instead of requiring users to provide tag and target_branch inputs.
Changes:
- Removes
workflow_dispatchinputs (tag,target_branch) and related env vars. - Introduces
REFderived fromgithub.ref_nameand uses it to computeVERSION. - Uses the dispatch ref for
actions/checkoutand passesREFinto-PgithubBranch.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| steps: | ||
| - name: "📝 Establish release version" | ||
| run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV" | ||
| run: echo "VERSION=${REF#v}" >> "$GITHUB_ENV" |
There was a problem hiding this 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*).
| run: echo "VERSION=${REF#v}" >> "$GITHUB_ENV" | |
| 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" |
| - name: "📖 Generate Documentation" | ||
| run: ./gradlew grails-doc:build -PgithubBranch=${TARGET_BRANCH} | ||
| run: ./gradlew grails-doc:build -PgithubBranch=${REF} |
There was a problem hiding this 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.
No description provided.