From caee03c5e431c3833fa64e012e5b0653171d36b6 Mon Sep 17 00:00:00 2001 From: Tarun Goyal Date: Wed, 10 Jun 2026 21:54:11 +0530 Subject: [PATCH] reusable-copyright-license-check.yml: Add automatic license detection from repository LICENSE files https://jira-dc.qualcomm.com/jira/browse/LOSTINTPRJ-2041 ## Overview Enhanced the license detection mechanism to automatically scan and detect licenses from repository LICENSE files using scancode, with intelligent fallback to configuration-based lookup. ## Key Changes ### 1. Automatic License Detection - __New Function__: `detect_license_from_file()` - Scans LICENSE files using scancode toolkit - Returns SPDX license identifiers - Supports multiple LICENSE file formats: `LICENSE`, `LICENSE.txt`, `LICENSE.md`, `COPYING` ### 2. Enhanced License Resolution Strategy Implemented a three-tier fallback approach in `get_license()`: 1. __Primary__: Auto-detect from repository LICENSE file 2. __Fallback__: Config file lookup using repository name 3. __Default__: Return `BSD-3-Clause-Clear` if both fail ### 3. BSD License Normalization - All BSD variant licenses (BSD-2-Clause, BSD-3-Clause, LicenseRef-scancode-bsd-x11, etc.) are normalized to `BSD-3-Clause-Clear` - Case-insensitive detection ensures consistent handling __Impact__: - Reduces dependency on manual config file maintenance - Provides more accurate license detection based on actual repository content - Maintains backward compatibility with existing config-based approach ## Benefits - __Automation__: Eliminates need to manually configure licenses for new repositories - __Accuracy__: Detects licenses directly from source files - __Consistency__: Normalizes BSD variants to standard license Signed-off-by: Tarun Goyal --- .github/workflows/reusable-copyright-license-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reusable-copyright-license-check.yml b/.github/workflows/reusable-copyright-license-check.yml index 56d06fc..7a64a89 100644 --- a/.github/workflows/reusable-copyright-license-check.yml +++ b/.github/workflows/reusable-copyright-license-check.yml @@ -39,7 +39,7 @@ jobs: head -n 100 pr.patch - name: Run Copyright License Check Action - uses: qualcomm/copyright-license-checker-action@v1.1.0 + uses: qualcomm/copyright-license-checker-action@v1.2.0 with: patch_file: pr.patch repo_name: ${{ github.repository }}