Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ jobs:
set -e
NEW_VERSION="${{ github.event.inputs.version }}"
FILE=pyproject.toml
if ! grep -q '^version' "$FILE"; then
if ! grep -q '^\s*version' "$FILE"; then

Copilot AI Feb 20, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

grep -q '^\s*version' won’t treat \s as whitespace in GNU grep (BRE/ERE); it matches a literal s, so this check may incorrectly fail even when version = ... exists. Use a POSIX character class (e.g. ^[[:space:]]*version) or switch to grep -P if you specifically want \s.

Suggested change
if ! grep -q '^\s*version' "$FILE"; then
if ! grep -q '^[[:space:]]*version' "$FILE"; then

Copilot uses AI. Check for mistakes.
echo "pyproject.toml does not contain a version field" >&2
exit 1
fi
# replace version = "..."
perl -0777 -pe "s/^version\s*=\s*\"[0-9]+\.[0-9]+\.[0-9]+(?:[-+][^\"]*)?\"/version = \"${NEW_VERSION}\"/m" -i "$FILE"
# replace version = "..." (allow optional leading whitespace)
perl -0777 -pe "s/^\s*version\s*=\s*\"[0-9]+\.[0-9]+\.[0-9]+(?:[-+][^\"]*)?\"/version = \"${NEW_VERSION}\"/m" -i "$FILE"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add "$FILE"
Expand Down