Skip to content

Commit 1d37825

Browse files
anakrishCopilot
andcommitted
ci: refresh ALL Cargo lockfiles on dependabot PRs
Dependabot security updates bypass the grouped-updates config and create per-directory PRs (one per Cargo.lock). This causes version skew — e.g. rand gets bumped in bindings/ruby but stays old elsewhere, breaking the build. Fix by unconditionally refreshing all lockfiles whenever any Cargo manifest or lockfile changes, rather than only the affected directory. Ref: dependabot/dependabot-core#7547 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 4fcc644 commit 1d37825

1 file changed

Lines changed: 23 additions & 36 deletions

File tree

.github/workflows/dependabot-refresh-cargo-lockfiles.yml

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
cargo --version
4242
rustc --version
4343
44-
- name: Refresh affected Cargo lockfiles
44+
- name: Refresh all Cargo lockfiles
4545
shell: bash
4646
run: |
4747
set -euo pipefail
@@ -56,31 +56,20 @@ jobs:
5656
exit 0
5757
fi
5858
59-
declare -A manifests=()
60-
for path in "${changed_files[@]}"; do
61-
case "$path" in
62-
bindings/ffi/*)
63-
manifests["bindings/ffi/Cargo.toml"]=1
64-
;;
65-
bindings/java/*)
66-
manifests["bindings/java/Cargo.toml"]=1
67-
;;
68-
bindings/python/*)
69-
manifests["bindings/python/Cargo.toml"]=1
70-
;;
71-
bindings/ruby/*)
72-
manifests["bindings/ruby/Cargo.toml"]=1
73-
;;
74-
bindings/wasm/*)
75-
manifests["bindings/wasm/Cargo.toml"]=1
76-
;;
77-
*)
78-
manifests["Cargo.toml"]=1
79-
;;
80-
esac
81-
done
82-
83-
for manifest in "${!manifests[@]}"; do
59+
# Always refresh ALL lockfiles when any Cargo change is detected.
60+
# Dependabot security updates bypass grouping and create per-directory
61+
# PRs, causing version skew if we only refresh the affected directory.
62+
# See: https://github.com/dependabot/dependabot-core/issues/7547
63+
all_manifests=(
64+
"Cargo.toml"
65+
"bindings/ffi/Cargo.toml"
66+
"bindings/java/Cargo.toml"
67+
"bindings/python/Cargo.toml"
68+
"bindings/ruby/Cargo.toml"
69+
"bindings/wasm/Cargo.toml"
70+
)
71+
72+
for manifest in "${all_manifests[@]}"; do
8473
echo "Refreshing lockfile for $manifest"
8574
cargo metadata \
8675
--config 'build.rustc="rustc"' \
@@ -91,16 +80,14 @@ jobs:
9180
--manifest-path "$manifest" > /dev/null
9281
done
9382
94-
if [[ -n "${manifests[Cargo.toml]+x}" ]]; then
95-
echo "Refreshing lockfile for tests/ensure_no_std/Cargo.toml (thumbv7m-none-eabi)"
96-
cargo metadata \
97-
--config 'build.rustc="rustc"' \
98-
--config 'build.rustc-wrapper=""' \
99-
--config 'build.rustc-workspace-wrapper=""' \
100-
--format-version 1 \
101-
--manifest-path tests/ensure_no_std/Cargo.toml \
102-
--filter-platform thumbv7m-none-eabi > /dev/null
103-
fi
83+
echo "Refreshing lockfile for tests/ensure_no_std/Cargo.toml (thumbv7m-none-eabi)"
84+
cargo metadata \
85+
--config 'build.rustc="rustc"' \
86+
--config 'build.rustc-wrapper=""' \
87+
--config 'build.rustc-workspace-wrapper=""' \
88+
--format-version 1 \
89+
--manifest-path tests/ensure_no_std/Cargo.toml \
90+
--filter-platform thumbv7m-none-eabi > /dev/null
10491
10592
- name: Commit lockfile refresh
10693
shell: bash

0 commit comments

Comments
 (0)