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
4 changes: 4 additions & 0 deletions scripts/run-pip-audit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ for dir in $PYTHON_DIRS; do
echo "::group::Scanning $dir"
trap 'echo "::endgroup::"' EXIT
cd "$GITHUB_WORKSPACE/$dir"
# Sync lock file in case pyproject.toml version was bumped (e.g. by
# release-please) without a corresponding `uv lock` run. This is a
# no-op when the lock file is already up to date.
uv lock
Comment on lines +24 to +27
Copy link

Copilot AI Apr 27, 2026

Choose a reason for hiding this comment

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

Running uv lock here changes the semantics of this check: previously uv export --locked would fail if the repo’s committed uv.lock was out of date, which helps catch PRs that modify dependency constraints but forget to update/commit the lockfile. With an unconditional uv lock, those PRs will now pass pip-audit by regenerating a lockfile in CI, and pip-audit may end up auditing dependencies that don’t match what’s committed.

Consider either (a) adding a follow-up guard that fails if uv lock produced substantive uv.lock changes that aren’t present in the PR (or at least emits a clear failure message instructing to commit the updated lock), or (b) scoping this behavior to the release-please/version-bump case so dependency drift still fails fast.

Suggested change
# Sync lock file in case pyproject.toml version was bumped (e.g. by
# release-please) without a corresponding `uv lock` run. This is a
# no-op when the lock file is already up to date.
uv lock
# Refresh the lockfile, but fail if this produces uncommitted changes.
# This preserves the original `uv export --locked` semantics: PRs that
# change dependency constraints without committing the updated `uv.lock`
# should fail fast instead of auditing CI-regenerated dependencies.
uv lock
if ! git diff --no-ext-diff --quiet --exit-code -- uv.lock; then
echo "::error file=$dir/uv.lock::uv.lock is out of date with the committed project metadata. Run 'uv lock' locally and commit the updated lockfile."
git --no-pager diff -- uv.lock
exit 1
fi

Copilot uses AI. Check for mistakes.
# --no-emit-project avoids exporting the local project as an editable
# requirement when hashes are present, which would cause pip / pip-audit
# to fail with "editable requirement cannot be installed when requiring
Expand Down
Loading