-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1017 Bytes
/
add-license.yml
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
name: Add License
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
add-license:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to retrieve full commit history
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Add License
run: |
output=$(python scripts/add_license.py) || ""
echo "$output"
if echo "$output" | grep -q "added"; then
echo "added_license=true" >> $GITHUB_STATE
else
echo "added_license=false" >> $GITHUB_STATE
fi
id: add_license
- name: Commit changes
if: steps.add_license.outputs.added_license == true
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "[email protected]"
git add --all
git commit -m "Add license to files"
git push