Create blank.yml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Fetch EPG | ||
on: | ||
schedule: | ||
- cron: '0 0 * * *' # Runs daily at midnight UTC | ||
workflow_dispatch: # Manual trigger | ||
jobs: | ||
download-epg: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 # Fetch only the latest commit to allow squash | ||
- name: Log EPG_URL variable | ||
run: echo "Fetching EPG from URL: ${{ secrets.EPG_URL }}" | ||
- name: Download the EPG file | ||
run: | | ||
curl -fSL "${{ secrets.EPG_URL }}" -o epg.xml | ||
shell: bash | ||
env: | ||
EPG_URL: ${{ secrets.EPG_URL }} | ||
- name: Log the downloaded file details | ||
run: | | ||
if [ -f "epg.xml" ]; then | ||
echo "EPG file downloaded successfully." | ||
ls -lh epg.xml | ||
else | ||
echo "Failed to download the EPG file." | ||
fi | ||
- name: Commit and push the EPG file (Squash Commit) | ||
run: | | ||
git config --global user.name "actions-user" | ||
git config --global user.email "actions@github.com" | ||
git add epg.xml | ||
git commit -m "Update EPG file" | ||
git fetch origin | ||
git rebase --interactive origin/main --autosquash | ||
git push --force-with-lease | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: success() # Only runs if previous steps succeed |