-
Notifications
You must be signed in to change notification settings - Fork 241
51 lines (45 loc) · 1.49 KB
/
add_license.yml
File metadata and controls
51 lines (45 loc) · 1.49 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
name: Add License to Python Files
on:
push:
branches:
- main
jobs:
add-license:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Run add_license.sh and check for changes
id: add_license
run: |
chmod +x scripts/add_license.sh
CHANGES=$(git status --porcelain)
./scripts/add_license.sh
NEW_CHANGES=$(git status --porcelain)
echo "::set-output name=changes::${NEW_CHANGES}"
- name: Commit changes if there are modifications
run: |
if [[ -n "${{ steps.add_license.outputs.changes }}" ]]; then
git config --local user.email "[email protected]"
git config --local user.name "Jina Dev Bot"
git add .
git commit -m "chore: add license to Python files"
git push
else
echo "No changes detected, skipping commit."
fi
if: steps.add_license.outputs.changes != ''
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: "Add license to Python files"
branch: "add-license"
commit-message: "chore: add license to Python files"
base: "main"
labels: "auto-merge"
token: ${{ secrets.JINA_DEV_BOT }}
if: steps.add_license.outputs.changes != ''