-
-
Notifications
You must be signed in to change notification settings - Fork 9
56 lines (51 loc) · 1.51 KB
/
run-sync-script.yaml
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
name: Run Sync Script
on:
push:
branches:
- main
permissions:
contents: write
jobs:
run-sync-script:
if: github.repository == 'SalamLang/Salam'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Python dependencies
run: |
cd config
if [ -f requirements.txt ]; then
cat requirements.txt
pip install -r requirements.txt
fi
- name: Run sync.py script
run: |
cd config
python3 sync.py
- name: Check for changes
id: check_changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "Changes detected"
echo "changes=true" >> $GITHUB_ENV
else
echo "No changes detected"
echo "changes=false" >> $GITHUB_ENV
fi
shell: bash
- name: Commit and push changes
if: env.changes == 'true'
run: |
FIRST_NAME="Max"
DOMAIN="gmail.com"
EMAIL="${FIRST_NAME}BaseCode@${DOMAIN}"
git config --global user.name "Max Base (GitHub Actions)"
git config --global user.email "$EMAIL"
git add -A
git commit -m "Auto-sync: Update after running sync.py script"
git push https://x-access-token:${{ secrets.USER_TOKEN }}@github.com/${{ github.repository }}.git