...

Text file src/github.com/aws/aws-sdk-go-v2/.github/workflows/license-check.yml

Documentation: github.com/aws/aws-sdk-go-v2/.github/workflows

     1name: License Scan
     2
     3on: [pull_request]
     4
     5jobs:
     6  licensescan:
     7    name: License Scan
     8    runs-on: ubuntu-latest
     9    strategy:
    10      matrix:
    11        python-version: [3.9]
    12
    13    steps:
    14      - name: Checkout target
    15        uses: actions/checkout@v2
    16        with:
    17          path: sdkbase
    18          ref: ${{ github.base_ref }}
    19      - name: Checkout this ref
    20        uses: actions/checkout@v2
    21        with:
    22          path: new-ref
    23          fetch-depth: 0
    24      - name: Get Diff
    25        run: git --git-dir ./new-ref/.git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > refDiffFiles.txt
    26      - name: Get Target Files
    27        run: git --git-dir ./sdkbase/.git ls-files | grep -xf refDiffFiles.txt - > targetFiles.txt
    28      - name: Checkout scancode
    29        uses: actions/checkout@v2
    30        with:
    31          repository: nexB/scancode-toolkit
    32          path: scancode-toolkit
    33          fetch-depth: 1
    34      - name: Set up Python ${{ matrix.python-version }}
    35        uses: actions/setup-python@v2
    36        with:
    37          python-version: ${{ matrix.python-version }}
    38      # ScanCode
    39      - name: Self-configure scancode
    40        working-directory: ./scancode-toolkit
    41        run: ./scancode --help
    42      - name: Run Scan code on target
    43        run: cat targetFiles.txt | while read filename; do echo ./sdkbase/$filename; done | xargs ./scancode-toolkit/scancode -l -n 30 --json-pp - | grep short_name | sort | uniq >> old-licenses.txt
    44      - name: Run Scan code on pr ref
    45        run: cat refDiffFiles.txt | while read filename; do echo ./new-ref/$filename; done | xargs ./scancode-toolkit/scancode -l -n 30 --json-pp - | grep short_name | sort | uniq >> new-licenses.txt
    46      # compare
    47      - name: License test
    48        run: if ! cmp old-licenses.txt new-licenses.txt; then echo "Licenses differ! Failing."; exit -1; else echo "Licenses are the same. Success."; exit 0; fi

View as plain text