You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iptv/.github/workflows/clean.yml

254 lines
5.5 KiB
YAML

4 years ago
name: clean
on:
workflow_dispatch:
4 years ago
schedule:
- cron: '0 6 * * 0'
4 years ago
jobs:
3 years ago
create-branch:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Create Branch
uses: peterjgrainger/action-create-branch@v2.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'bot/remove-broken-links'
3 years ago
test:
4 years ago
runs-on: ubuntu-latest
4 years ago
continue-on-error: true
4 years ago
strategy:
4 years ago
fail-fast: false
4 years ago
matrix:
3 years ago
country:
[
ad,
ae,
af,
3 years ago
ag,
al,
am,
3 years ago
an,
ao,
ar,
at,
au,
aw,
az,
ba,
bb,
bd,
be,
bf,
bg,
bh,
bn,
bo,
br,
bs,
by,
ca,
cd,
cg,
ch,
ci,
cl,
cm,
cn,
co,
cr,
cu,
cw,
cy,
cz,
de,
dk,
do,
dz,
ec,
ee,
eg,
es,
et,
fi,
fj,
fo,
fr,
3 years ago
pf,
ge,
gh,
gm,
gn,
gp,
gq,
gr,
gt,
hk,
hn,
hr,
ht,
hu,
id,
ie,
il,
in,
iq,
ir,
is,
it,
jm,
jo,
jp,
ke,
kg,
kh,
kp,
kr,
kw,
kz,
la,
lb,
li,
lk,
lt,
lu,
lv,
ly,
ma,
mc,
md,
me,
mk,
ml,
mm,
mn,
mo,
mt,
3 years ago
mv,
mx,
my,
mz,
ne,
ng,
3 years ago
ni,
nl,
no,
np,
nz,
om,
pa,
pe,
ph,
pk,
pl,
pr,
ps,
pt,
py,
qa,
ro,
rs,
ru,
rw,
sa,
sd,
se,
sg,
si,
sk,
sl,
sm,
sn,
so,
sv,
sy,
th,
tj,
tm,
tn,
tr,
tt,
tw,
tz,
ua,
ug,
uk,
us,
uy,
uz,
va,
ve,
vi,
vn,
xk,
ye,
3 years ago
zm,
unsorted
4 years ago
]
steps:
- name: Checkout
uses: actions/checkout@v2
3 years ago
with:
ref: bot/remove-broken-links
4 years ago
- name: Install Dependencies
run: npm install
- name: Remove Broken Links
4 years ago
run: node scripts/clean.js --country=${{ matrix.country }} --debug
4 years ago
- name: Upload Artifact
uses: actions/upload-artifact@v2
4 years ago
with:
4 years ago
name: channels
4 years ago
path: channels/${{ matrix.country }}.m3u
3 years ago
commit-changes:
4 years ago
runs-on: ubuntu-latest
3 years ago
needs: test
4 years ago
steps:
- name: Checkout
uses: actions/checkout@v2
3 years ago
with:
ref: bot/remove-broken-links
4 years ago
- name: Download Artifacts
uses: actions/download-artifact@v2
3 years ago
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[Bot] Update playlists'
commit_user_name: iptv-bot
commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com
commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>'
branch: bot/remove-broken-links
file_pattern: channels/*
pull-request:
runs-on: ubuntu-latest
needs: commit-changes
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: bot/remove-broken-links
3 years ago
- name: Generate Token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
4 years ago
- name: Create Pull Request
3 years ago
uses: repo-sync/pull-request@v2
4 years ago
with:
3 years ago
source_branch: 'bot/remove-broken-links'
destination_branch: 'master'
pr_title: '[Bot] Remove broken links'
pr_body: |
This pull request is created by [clean][1] workflow.
4 years ago
4 years ago
The script checks each link and removes only those that return a HTTP 404 code (Not Found). Also, the script ignores links with labels `[Geo-blocked]` and `[Not 24/7]` in the title.
4 years ago
3 years ago
**IMPORTANT:** Before merging all links should be checked manually to make sure that the response from the server has not changed. Working links should be marked as `[Not 24/7]` so that next time the script will not delete them.
3 years ago
[1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}
pr_draft: true
github_token: ${{ steps.generate-token.outputs.token }}