2021-05-06 15:57:50 +03:00
name : clean
on :
workflow_dispatch :
2021-08-09 03:31:59 +03:00
schedule :
- cron : '0 6 * * 0'
2021-05-06 15:57:50 +03:00
jobs :
2021-08-03 22:33:25 +03:00
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'
2021-08-09 03:31:59 +03:00
check :
2021-05-06 15:57:50 +03:00
runs-on : ubuntu-latest
2021-08-08 13:59:16 +03:00
needs : create-branch
2021-05-06 23:44:12 +03:00
continue-on-error : true
2021-05-06 15:57:50 +03:00
strategy :
2021-05-06 23:44:12 +03:00
fail-fast : false
2021-05-06 15:57:50 +03:00
matrix :
2021-08-08 15:07:56 +03:00
country :
[
2021-08-08 14:33:33 +03:00
ad,
2021-08-08 15:07:56 +03:00
ae,
af,
ag,
al,
am,
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,
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,
mv,
mx,
my,
mz,
ne,
ng,
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,
zm,
unsorted
2021-05-06 15:57:50 +03:00
]
steps :
- name : Checkout
uses : actions/checkout@v2
2021-08-03 22:33:25 +03:00
with :
ref : bot/remove-broken-links
2021-08-08 13:37:00 +03:00
- name : Setup FFmpeg
uses : FedericoCarboni/setup-ffmpeg@v1
2021-05-06 15:57:50 +03:00
- name : Install Dependencies
run : npm install
- name : Remove Broken Links
2021-05-07 02:52:11 +03:00
run : node scripts/clean.js --country=${{ matrix.country }} --debug
2021-05-06 22:15:10 +03:00
- name : Upload Artifact
uses : actions/upload-artifact@v2
2021-05-06 22:07:47 +03:00
with :
2021-05-06 23:09:22 +03:00
name : channels
2021-05-06 23:26:14 +03:00
path : channels/${{ matrix.country }}.m3u
2021-08-03 22:33:25 +03:00
commit-changes :
2021-05-06 22:07:47 +03:00
runs-on : ubuntu-latest
2021-08-09 03:31:59 +03:00
needs : check
2021-05-06 22:07:47 +03:00
steps :
- name : Checkout
uses : actions/checkout@v2
2021-08-03 22:33:25 +03:00
with :
ref : bot/remove-broken-links
2021-05-06 22:15:10 +03:00
- name : Download Artifacts
uses : actions/download-artifact@v2
2021-08-03 22:33:25 +03:00
- name : Commit Changes
uses : stefanzweifel/git-auto-commit-action@v4
with :
2021-08-09 03:31:59 +03:00
commit_message : '[Bot] Remove broken links'
2021-08-03 22:33:25 +03:00
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 :
2021-08-08 14:12:47 +03:00
if : ${{ github.ref == 'refs/heads/master' }}
2021-08-03 22:33:25 +03:00
runs-on : ubuntu-latest
needs : commit-changes
steps :
- name : Checkout
uses : actions/checkout@v2
with :
ref : bot/remove-broken-links
2021-05-27 12:39:30 +03:00
- name : Generate Token
uses : tibdex/github-app-token@v1
id : generate-token
with :
app_id : ${{ secrets.APP_ID }}
private_key : ${{ secrets.APP_PRIVATE_KEY }}
2021-05-06 20:44:23 +03:00
- name : Create Pull Request
2021-08-03 22:33:25 +03:00
uses : repo-sync/pull-request@v2
2021-05-06 20:44:23 +03:00
with :
2021-08-03 22:33:25 +03:00
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.
2021-05-07 14:59:29 +03:00
2021-08-09 14:35:51 +03:00
The script checks all links except those with labels `[Geo-blocked]`, `[Offline]` or `[Not 24/7]` in the title.
2021-05-07 14:59:29 +03:00
2021-08-09 14:35:51 +03:00
**IMPORTANT:** Before merging all links should be checked manually to make sure that the response from the server has not changed. If the link works for you but occasionally return an HTTP code 403 (Forbidden) then it should be marked as `[Geo-blocked]`. If the link does not work but has no alternative, you can mark it as `[Offline]` to save it in the playlist along with a description. Working links should be marked as `[Not 24/7]` so that the script will skip them next time.
2021-08-03 22:33:25 +03:00
[1] : https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}
pr_draft : true
github_token : ${{ steps.generate-token.outputs.token }}