IPTV/.github/workflows/test_playlist.yml

86 lines
2.4 KiB
YAML

name: Test IPTV file quality
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: "20.10.x"
- name: Install m3u-linter and check the playlist
run: |
npm install -g m3u-linter || true
cat <<EOF > M3u-linter.config.json
{
"files": ["playlist.m3u8"],
"rules": {
"no-empty-lines": true,
"require-header": true,
"attribute-quotes": true,
"require-info": true,
"no-trailing-spaces": true,
"no-whitespace-before-title": true,
"no-multi-spaces": false,
"no-extra-comma": true,
"space-before-paren": false,
"no-dash": true
}
}
EOF
m3u-linter -c ./M3u-linter.config.json ./playlist.m3u8 | tee m3u-linter-output.txt || true
- name: Summarize m3u-linter results
if: always()
run: |
{
echo "## m3u-linter results"
echo ""
echo '```'
cat m3u-linter-output.txt 2>/dev/null || echo "(no output)"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Install IPTV Checker and check the playlist
run: |
npm install -g iptv-checker || true
mkdir -p output
sudo apt-get install -y ffmpeg
iptv-checker -o output -p 100 -t 120000 ./playlist.m3u8 || true
- name: Summarize checker results
if: always()
run: |
online=$(grep -c '^#EXTINF' output/online.m3u 2>/dev/null || echo 0)
failed=$(grep -c '^#EXTINF' output/failed.m3u 2>/dev/null || echo 0)
{
echo "## IPTV Checker results"
echo ""
echo "- Online: $online"
echo "- Failed: $failed"
echo ""
echo "### Failed channels"
echo '```'
grep '^#EXTINF' output/failed.m3u 2>/dev/null || echo "(none)"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Upload checker results
if: always()
uses: actions/upload-artifact@v4
with:
name: iptv-checker-results
path: output/
retention-days: 14