-
Notifications
You must be signed in to change notification settings - Fork 390
36 lines (34 loc) · 1.06 KB
/
prepend-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
on:
pull_request:
types: [opened, synchronize]
name: Add license header to files
jobs:
add_license_header:
name: Add license header to files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.GH_PR_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Download reuse tool
run: pip3 install --user reuse
- name: Setup git config
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
- name: Adding license header to files
run: ci-scripts/prepend-license.sh
- name: push added headers
run: |
git pull origin ${{ github.event.pull_request.head.ref }}
if [ -z $(git status --porcelain) ];
then
echo "No files to commit"
else
git commit -am "Add license header"
git push
fi