From 6482e5b2e2cfda1e485eaf122374cc5b0494ece6 Mon Sep 17 00:00:00 2001 From: arijitroy003 Date: Wed, 29 Jul 2026 18:05:42 +0530 Subject: [PATCH] Add CI check for LICENSE and NOTICE files in published crates Prevents future policy violations by checking that all workspace crates include the required Apache license files. Related to #10469 Signed-off-by: arijitroy003 --- .github/workflows/check-licenses.yml | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/check-licenses.yml diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml new file mode 100644 index 000000000000..86c9db688857 --- /dev/null +++ b/.github/workflows/check-licenses.yml @@ -0,0 +1,29 @@ +name: Check License Files +on: + pull_request: + paths: + - '**/Cargo.toml' + push: + branches: [main] + +jobs: + check-licenses: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check LICENSE and NOTICE files + run: | + missing=0 + for dir in $(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].manifest_path' | xargs -I{} dirname {}); do + for file in LICENSE.txt NOTICE.txt; do + if [ ! -f "$dir/$file" ] && [ ! -L "$dir/$file" ]; then + echo "MISSING: $dir/$file" + missing=$((missing + 1)) + fi + done + done + if [ $missing -gt 0 ]; then + echo "Found $missing missing license files" + exit 1 + fi + echo "All crates have LICENSE.txt and NOTICE.txt"