1name: Scancode
2
3on: [pull_request]
4
5jobs:
6  scancode_job:
7    runs-on: ubuntu-22.04
8    name: Scan code for licenses
9    steps:
10    - name: Checkout the code
11      uses: actions/checkout@v4
12      with:
13        fetch-depth: 0
14    - name: Scan the code
15      id: scancode
16      uses: zephyrproject-rtos/action_scancode@v4
17      with:
18        directory-to-scan: 'scan/'
19    - name: Artifact Upload
20      uses: actions/upload-artifact@v4
21      with:
22        name: scancode
23        path: ./artifacts
24
25    - name: Verify
26      run: |
27        if [ -s ./artifacts/report.txt ]; then
28          report=$(cat ./artifacts/report.txt)
29          report="${report//'%'/'%25'}"
30          report="${report//$'\n'/'%0A'}"
31          report="${report//$'\r'/'%0D'}"
32          echo "::error file=./artifacts/report.txt::$report"
33          exit 1
34        fi
35