name: EPG Fetcher

on:
  schedule:
    - cron: '0 */6 * * *' # 每 6 小时运行一次

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout repository
      uses: actions/checkout@v3

    - name: Fetch EPG Files
      run: |
        rm -f epg.xml
        wget -O epg.xml https://epg.112114.xyz/pp.xml
        git config --local user.name "github-actions[bot]"
        git config --local user.email "github-actions[bot]@users.noreply.github.com"
        git add epg.xml
        git commit -m "Update EPG files" || echo "No changes to commit"

    - name: Push changes
      run: |
        git push origin main
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
