-
Notifications
You must be signed in to change notification settings - Fork 46
57 lines (45 loc) · 1.51 KB
/
update-vpn-configs.yml
File metadata and controls
57 lines (45 loc) · 1.51 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
name: Update VPN Configs
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *' # every hour at minute 00 (UTC)
jobs:
update-configs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.13'
- name: Create virtual environment
run: python -m venv venv --copies
- name: Upgrade pip
run: ./venv/bin/python -m pip install --upgrade pip
- name: Install requirements
run: ./venv/bin/python -m pip install -r source/requirements.txt
- name: Run main script
run: ./venv/bin/python source/main.py
- name: Configure Git user
run: |
git config user.name "github-actions"
git config user.email "actions@github.com"
git remote set-url origin https://x-access-token:${{ secrets.PAT_TOKEN }}@github.com/${{ github.repository }}
- name: Check for changes
run: |
git status
git diff --stat
- name: Commit changes if needed
run: |
git add .
git diff --cached --quiet || git commit -m "Auto-update VPN configs"
- name: Push changes if committed
run: |
if git log -1 --pretty=format:"%s" | grep -q "Auto-update VPN configs"; then
git push origin main
else
echo "No new commit to push."
fi