|
| 1 | +name: Update 3rd-party licenses |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - 'yarn.lock' |
| 9 | + |
| 10 | +jobs: |
| 11 | + update-3rdparty-licenses: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + id-token: write |
| 15 | + contents: write |
| 16 | + pull-requests: write |
| 17 | + env: |
| 18 | + REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }} |
| 19 | + steps: |
| 20 | + - name: Check out PR branch |
| 21 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 22 | + |
| 23 | + - name: Get GitHub token with appropriate permissions |
| 24 | + uses: DataDog/dd-octo-sts-action@acaa02eee7e3bb0839e4272dacb37b8f3b58ba80 # v1.0.3 |
| 25 | + id: octo-sts |
| 26 | + with: |
| 27 | + scope: DataDog |
| 28 | + policy: dd-trace-js-license-attribution-read |
| 29 | + |
| 30 | + - name: Set up Python |
| 31 | + uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0 |
| 32 | + with: |
| 33 | + python-version: '3.14' |
| 34 | + |
| 35 | + - name: Check out dd-license-attribution |
| 36 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 37 | + with: |
| 38 | + repository: DataDog/dd-license-attribution |
| 39 | + ref: 848797a26d0cfd009482976d05af7f492bb5242c |
| 40 | + path: dd-license-attribution |
| 41 | + |
| 42 | + - name: Install dd-license-attribution |
| 43 | + working-directory: dd-license-attribution |
| 44 | + run: | |
| 45 | + pip install . |
| 46 | +
|
| 47 | + - name: Create mirrors.json for PR branch |
| 48 | + env: |
| 49 | + DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} |
| 50 | + HEAD_REF: ${{ github.head_ref }} |
| 51 | + run: | |
| 52 | + cat > mirrors.json <<EOF |
| 53 | + [ |
| 54 | + { |
| 55 | + "original_url": "${REPOSITORY_URL}", |
| 56 | + "mirror_url": "${REPOSITORY_URL}", |
| 57 | + "ref_mapping": { |
| 58 | + "branch:${DEFAULT_BRANCH}": "branch:${HEAD_REF}" |
| 59 | + } |
| 60 | + } |
| 61 | + ] |
| 62 | + EOF |
| 63 | +
|
| 64 | + - name: Regenerate LICENSE-3rdparty.csv |
| 65 | + env: |
| 66 | + GITHUB_TOKEN: ${{ steps.octo-sts.outputs.token }} |
| 67 | + run: | |
| 68 | + dd-license-attribution generate-sbom-csv \ |
| 69 | + --use-mirrors=mirrors.json \ |
| 70 | + --no-scancode-strategy \ |
| 71 | + --no-github-sbom-strategy \ |
| 72 | + "${REPOSITORY_URL}" > LICENSE-3rdparty.csv |
| 73 | +
|
| 74 | + - name: Run LICENSE-3rdparty.csv update check |
| 75 | + env: |
| 76 | + PR_AUTHOR: ${{ github.event.pull_request.user.login }} |
| 77 | + PR_USER_TYPE: ${{ github.event.pull_request.user.type }} |
| 78 | + GITHUB_EVENT_NAME: ${{ github.event_name }} |
| 79 | + run: ./.github/scripts/update-3rdparty-licenses.sh |
0 commit comments