From 3b625aaaa97b33d224e2c0445c441e481ccc4971 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 7 Feb 2020 20:51:06 -0500 Subject: [PATCH] ci: add license check using github actions Use Github for license checks. Signed-off-by: Anas Nashif --- .github/license_config.yml | 16 +++++++++++++++ .github/workflows/license_check.yml | 32 +++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .github/license_config.yml create mode 100644 .github/workflows/license_check.yml diff --git a/.github/license_config.yml b/.github/license_config.yml new file mode 100644 index 00000000000..b5bd5842307 --- /dev/null +++ b/.github/license_config.yml @@ -0,0 +1,16 @@ +license: + main: apache-2.0 + report_missing: true + category: Permissive +copyright: + check: true +exclude: + extensions: + - yml + - yaml + - html + - rst + - conf + - cfg + langs: + - HTML diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml new file mode 100644 index 00000000000..9ece6590145 --- /dev/null +++ b/.github/workflows/license_check.yml @@ -0,0 +1,32 @@ +name: Scancode + +on: [pull_request] + +jobs: + scancode_job: + runs-on: ubuntu-latest + name: Scan code for licenses + steps: + - name: Checkout the code + uses: actions/checkout@v1 + - name: Scan the code + id: scancode + uses: zephyrproject-rtos/action_scancode@v2 + with: + directory-to-scan: 'scan/' + - name: Artifact Upload + uses: actions/upload-artifact@v1 + with: + name: scancode + path: ./artifacts + + - name: Verify + run: | + if [ -s ./artifacts/report.txt ]; then + report=$(cat ./artifacts/report.txt) + report="${report//'%'/'%25'}" + report="${report//$'\n'/'%0A'}" + report="${report//$'\r'/'%0D'}" + echo "::error file=./artifacts/report.txt::$report" + exit 1 + fi