-
Notifications
You must be signed in to change notification settings - Fork 2
81 lines (67 loc) · 2.46 KB
/
Copy pathauto-update-licenses.yaml
File metadata and controls
81 lines (67 loc) · 2.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Auto-update Licenses
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'yarn.lock'
- 'package.json'
- '**/package.json'
- '.ddla-overrides'
permissions:
contents: write
packages: read
jobs:
update-licenses:
# Only run on PRs from the same repository (not forks)
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.11.12'
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v5.0.0
with:
node-version: '18'
cache: 'yarn'
- name: Set up Golang
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # 6.0.0
with:
go-version: '1.23'
- name: Clone dd-license-attribution
run: |
git clone https://github.com/DataDog/dd-license-attribution.git /tmp/dd-license-attribution
- name: Install dd-license-attribution
run: |
python -m pip install --upgrade pip
python -m pip install /tmp/dd-license-attribution
- name: Install project dependencies
run: yarn install --frozen-lockfile
- name: Generate licenses
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn licenses:generate
- name: Check for changes
id: check_changes
run: |
if git diff --quiet LICENSE-3rdparty.csv; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add LICENSE-3rdparty.csv
git commit -m "chore: auto-update LICENSE-3rdparty.csv
Updated license file to reflect current dependencies.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
git push