Skip to content

Clash config generator #156

Clash config generator

Clash config generator #156

Workflow file for this run

name: Clash config generator
on:
push:
branches: 'main'
paths:
- '**/winterguard.*'
- 'edge/assets/*.yml'
schedule:
- cron: '0 8 * * *'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ secrets.GITHUB_TOKEN }}
- name: List directory contents
run: |
ls -R edge
cat edge/requirements.txt
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: pip
- name: Cache Python packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('edge/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip || exit 1
pip install -r edge/requirements.txt || exit 1
- name: Run config generation script
run: |
python edge/winterguard.py 2>&1 || { echo "Script failed with exit code $?"; exit 1; }
- name: Commit and push config files
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "actions-bot@users.noreply.github.com"
if git status --porcelain | grep -q "sub/clash-meta-wg.yml" || git status --porcelain; then
echo "Changes detected. Committing and pushing."
git add sub/clash-meta-wg.yml
git commit -m "Auto: Update clash-wireGuard configurations at: $(TZ='Asia/Tehran' date '+%H:%M:%S')" -m "Wireguard private key, reserved, addresses and all IPs have been renewed" --author="Diana-Cl <135276904+Diana-Cl@users.noreply.github.com>"
git push
else
echo "No changes detected in config files."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}