|
| 1 | +name: License Check |
| 2 | + |
| 3 | +on: pull_request |
| 4 | + |
| 5 | +jobs: |
| 6 | + license_job: |
| 7 | + runs-on: ubuntu-24.04 |
| 8 | + name: Run license checks on patch series (PR) |
| 9 | + steps: |
| 10 | + - name: Checkout the code |
| 11 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 |
| 12 | + with: |
| 13 | + path: ncs/nrf-bm |
| 14 | + ref: ${{ github.event.pull_request.head.sha }} |
| 15 | + fetch-depth: 0 |
| 16 | + |
| 17 | + - name: cache-pip |
| 18 | + uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3 |
| 19 | + with: |
| 20 | + path: ~/.cache/pip |
| 21 | + key: ${{ runner.os }}-doc-pip |
| 22 | + |
| 23 | + - name: Install python dependencies |
| 24 | + run: | |
| 25 | + pip3 install -U pip |
| 26 | + pip3 install -U setuptools |
| 27 | + export PATH="$HOME/.local/bin:$PATH" |
| 28 | + pip3 install -U wheel |
| 29 | + pip3 install --user -U west |
| 30 | + pip3 show -f west |
| 31 | +
|
| 32 | + - name: Prepare west project |
| 33 | + working-directory: ncs |
| 34 | + run: | |
| 35 | + west init -l nrf-bm |
| 36 | + west update -o=--depth=1 -n |
| 37 | +
|
| 38 | + - name: West zephyr-export |
| 39 | + working-directory: ncs |
| 40 | + env: |
| 41 | + PR_REF: ${{ github.event.pull_request.head.sha }} |
| 42 | + run: | |
| 43 | + export PATH="$HOME/.local/bin:$PATH" |
| 44 | + export PATH="$HOME/bin:$PATH" |
| 45 | + west zephyr-export |
| 46 | + echo "ZEPHYR_BASE=$(pwd)/zephyr" >> $GITHUB_ENV |
| 47 | + # debug |
| 48 | + ( cd nrf-bm; echo "nrf-bm"; git log --pretty=oneline --max-count=10 ) |
| 49 | + ( cd nrf; echo "nrf"; git log --pretty=oneline --max-count=10 ) |
| 50 | + ( cd zephyr; echo "zephyr"; git log --pretty=oneline --max-count=10 ) |
| 51 | +
|
| 52 | + - name: Install license check script dependencies |
| 53 | + run: | |
| 54 | + pip3 install -U -r ncs/nrf/scripts/ci/requirements.txt |
| 55 | +
|
| 56 | + - name: Run license checks |
| 57 | + id: license_checks |
| 58 | + env: |
| 59 | + BASE_REF: ${{ github.base_ref }} |
| 60 | + ZEPHYR_BASE: ${{ env.ZEPHYR_BASE }} |
| 61 | + working-directory: ncs/nrf-bm |
| 62 | + if: contains(github.event.pull_request.user.login, 'dependabot[bot]') != true |
| 63 | + run: | |
| 64 | + export PATH="$HOME/.local/bin:$PATH" |
| 65 | + export PATH="$HOME/bin:$PATH" |
| 66 | + ${ZEPHYR_BASE}/../nrf/scripts/ci/check_license.py \ |
| 67 | + --github \ |
| 68 | + -l ${ZEPHYR_BASE}/../nrf-bm/scripts/ci/license_allow_list.yaml \ |
| 69 | + -c origin/${BASE_REF}.. |
| 70 | +
|
| 71 | + - name: Upload results |
| 72 | + uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4 |
| 73 | + continue-on-error: true |
| 74 | + if: always() && contains(github.event.pull_request.user.login, 'dependabot[bot]') != true |
| 75 | + with: |
| 76 | + name: licenses.xml |
| 77 | + path: ncs/nrf-bm/licenses.xml |
| 78 | + overwrite: true |
0 commit comments