mirror of https://github.com/Free-TV/IPTV
Switch weekly trend workflow to artifacts instead of repo commits
Stores the failed-channel snapshot as a workflow artifact (90-day retention) and downloads the previous run's artifact for comparison, instead of committing a state file back to the repo.master
parent
0026bd1378
commit
4169248c71
|
|
@ -22,17 +22,29 @@ jobs:
|
|||
npm install -g iptv-checker || true
|
||||
sudo apt-get update && sudo apt-get install -y ffmpeg
|
||||
|
||||
- name: Download last week's snapshot (if any)
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
mkdir -p prev_snapshot
|
||||
prev_run=$(gh run list --repo "${{ github.repository }}" --workflow weekly_trend.yml --status success --limit 1 --json databaseId -q '.[0].databaseId' || true)
|
||||
if [ -n "$prev_run" ]; then
|
||||
echo "Found previous successful run: $prev_run"
|
||||
gh run download "$prev_run" --repo "${{ github.repository }}" -n checker-history -D prev_snapshot || echo "No artifact on that run (probably the very first one)."
|
||||
else
|
||||
echo "No previous successful run found — this is the first run."
|
||||
fi
|
||||
|
||||
- name: Run checker against the full playlist
|
||||
run: |
|
||||
mkdir -p output
|
||||
iptv-checker -o output -p 100 -t 120000 ./playlist.m3u8 || true
|
||||
|
||||
- name: Compare against last week's snapshot and update it
|
||||
- name: Compare against last week's snapshot
|
||||
run: |
|
||||
mkdir -p .github/checker-history
|
||||
today=$(date -u +%Y-%m-%d)
|
||||
prev_file=".github/checker-history/failed.txt"
|
||||
curr_file=".github/checker-history/failed-current.txt"
|
||||
mkdir -p snapshot
|
||||
curr_file="snapshot/failed.txt"
|
||||
prev_file="prev_snapshot/failed.txt"
|
||||
|
||||
grep '^http' output/failed.m3u 2>/dev/null | sort -u > "$curr_file" || touch "$curr_file"
|
||||
|
||||
|
|
@ -40,7 +52,7 @@ jobs:
|
|||
failed=$(grep -c '^#EXTINF' output/failed.m3u 2>/dev/null || echo 0)
|
||||
|
||||
{
|
||||
echo "## Weekly channel health trend — $today"
|
||||
echo "## Weekly channel health trend — $(date -u +%Y-%m-%d)"
|
||||
echo ""
|
||||
echo "- Online: $online"
|
||||
echo "- Failed: $failed"
|
||||
|
|
@ -75,18 +87,9 @@ jobs:
|
|||
echo "_(no previous snapshot — this is the first run, nothing to compare against yet)_" >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
|
||||
mv "$curr_file" "$prev_file"
|
||||
|
||||
- name: Commit updated snapshot
|
||||
run: |
|
||||
git config user.name "PlaylistBot"
|
||||
git config user.email "playlistbot@users.noreply.github.com"
|
||||
git add .github/checker-history/failed.txt
|
||||
git diff --staged --quiet && exit 0
|
||||
git commit -m "Weekly checker snapshot ($(date -u +%Y-%m-%d))"
|
||||
for i in 1 2 3 4 5; do
|
||||
git fetch origin master
|
||||
git rebase origin/master && git push && break
|
||||
echo "Push attempt $i failed, retrying..."
|
||||
sleep 5
|
||||
done
|
||||
- name: Upload this week's snapshot for next time
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: checker-history
|
||||
path: snapshot/failed.txt
|
||||
retention-days: 90
|
||||
|
|
|
|||
Loading…
Reference in New Issue