Skip to content

Trim whitespace from codeql_version input in update-codeql-version workflow - #220

Draft
felickz with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-github-actions-validation
Draft

Trim whitespace from codeql_version input in update-codeql-version workflow#220
felickz with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-github-actions-validation

Conversation

Copilot AI commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

The Validate and normalize version input step stripped an optional leading v but never trimmed whitespace, so a dispatched value of " 2.26.3" failed the ^[0-9]+\.[0-9]+\.[0-9]+$ check with codeql_version must look like X.Y.Z, got: 2.26.3.

Changes

  • Trim before validating: leading and trailing POSIX whitespace is stripped from inputs.codeql_version before the v prefix removal and the X.Y.Z regex check.
  • Error message reports the normalized value: uses $VERSION instead 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.
VERSION="${{ inputs.codeql_version }}"
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
  echo "::error::codeql_version must look like X.Y.Z, got: $VERSION"
  exit 1
fi

2.26.3 and v2.26.3 remain 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/*.sh have no accompanying test suite), so the change was verified by extracting the step script and running it against the accept/reject cases above.

Copilot AI and others added 2 commits August 17, 2026 19:33
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
Copilot AI requested a review from felickz August 17, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants