Trim whitespace from codeql_version input in update-codeql-version workflow - #220
Merged
Conversation
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix GitHub Actions workflow validation for codeql version
Trim whitespace from codeql_version input in update-codeql-version workflow
Aug 17, 2026
felickz
marked this pull request as ready for review
August 25, 2026 20:56
Copilot stopped reviewing on behalf of
felickz due to an error
August 25, 2026 20:56
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
Updates the CodeQL version validation step to be more tolerant of user input formatting while keeping strict semantic version checks.
Changes:
- Trim leading/trailing whitespace from the
codeql_versioninput before validation. - Improve normalization by continuing to accept an accidental leading
v. - Adjust the validation error message to print the post-processed version.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/update-codeql-version.yml | Normalizes and validates the CodeQL version input more robustly in the workflow step. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 1/1 changed files
- Comments generated: 3
- Review effort level: Lite
| VERSION="${VERSION#v}" # tolerate an accidental leading "v" | ||
| if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
| echo "::error::codeql_version must look like X.Y.Z, got: ${{ inputs.codeql_version }}" | ||
| echo "::error::codeql_version must look like X.Y.Z, got: $VERSION" |
| @@ -54,9 +54,11 @@ jobs: | |||
| run: | | |||
| set -euo pipefail | |||
| VERSION="${VERSION#"${VERSION%%[![:space:]]*}"}" # trim leading whitespace | ||
| VERSION="${VERSION%"${VERSION##*[![:space:]]}"}" # trim trailing whitespace | ||
| VERSION="${VERSION#v}" # tolerate an accidental leading "v" | ||
| if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
Validate and normalize version inputstep stripped an optional leadingvbut never trimmed whitespace, so a dispatched value of" 2.26.3"failed the^[0-9]+\.[0-9]+\.[0-9]+$check withcodeql_version must look like X.Y.Z, got: 2.26.3.Changes
inputs.codeql_versionbefore thevprefix removal and theX.Y.Zregex check.$VERSIONinstead of re-interpolating${{ inputs.codeql_version }}, so the reported value is the one that actually failed the check, and the step interpolates the workflow expression into shell only once.2.26.3andv2.26.3remain accepted;2.26,2.26.3.4, values with internal whitespace, and empty/whitespace-only input are still rejected.Tests
No test added. The repository has no harness for exercising inline workflow shell steps (
.github/scripts/*.shhave no accompanying test suite), so the change was verified by extracting the step script and running it against the accept/reject cases above.