forked from firecracker-microvm/firecracker
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (29 loc) · 1.04 KB
/
deny_dirty_cargo_locks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
name: Check no Cargo.lock files are dirty
on: pull_request
jobs:
no_dirty_cargo_locks_check:
runs-on: ubuntu-latest
steps:
- name: "Checkout repository"
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: "Check no Cargo.lock files are dirty"
run: |
exit_code=0
# This breaks for paths with whitespaces in them, but we have an integration test
# that prevents those from existing in this repository.
for f in $(find . -name 'Cargo.lock' -not -path "./build/*"); do
is_dirty=0
(
cd "$(dirname "$f")"
cargo --locked metadata --format-version 1 >/dev/null 2>&1
) || is_dirty=$?;
# GitHub Actions execute run steps as `bash -e`, so we need the temporary
# variable to not exit early.
if [ $is_dirty -ne 0 ]; then
echo "Lockfile $f is dirty"
exit_code=1
fi
done
exit $exit_code