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/cibuildwheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build Wheels
on:
push:
branches: [ main, master ]
tags: [ 'v*' ]
tags: [ 'v*', '[0-9]*' ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

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

The updated if condition startsWith(github.ref, 'refs/tags/') is overly broad: it will trigger build_sdist and upload_pypi for any tag pushed to the repository, not just version tags. For example, pushing a tag like test-release, debug, or hotfix-wip would cause an upload to PyPI.

The intent of the PR is to support both v* and [0-9]* style version tags. The if condition should be tightened to match only those two patterns. GitHub Actions expressions support startsWith checks with ||, so the condition should be something like:
github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref =~ 'refs/tags/[0-9]')

Alternatively, using a reusable condition or a dedicated helper step to set an output would work. At minimum, the condition should guard against non-version tags triggering a PyPI publish, since uploading an incorrect or untested artifact to PyPI could cause significant issues for downstream users.

Suggested change
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref =~ 'refs/tags/[0-9]')

Copilot uses AI. Check for mistakes.

steps:
- uses: actions/checkout@v5
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')

Copilot AI Mar 1, 2026

Copy link

Choose a reason for hiding this comment

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

Same issue as in build_sdist: the condition startsWith(github.ref, 'refs/tags/') will trigger a PyPI upload for any pushed tag, not just version-style tags (v* or [0-9]*). This should be narrowed to match only the version tag patterns that the workflow is designed to handle, to avoid accidentally publishing to PyPI from non-release tags.

Copilot uses AI. Check for mistakes.
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

Expand Down