2021-08-16 19:51:10 +02:00
|
|
|
name: cleanup
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
2021-12-12 05:08:31 +01:00
|
|
|
cleanup:
|
2021-08-16 19:51:10 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2021-12-12 05:08:31 +01:00
|
|
|
- uses: actions/checkout@v2
|
2021-12-12 05:39:44 +01:00
|
|
|
- run: echo "::set-output name=branch_name::$(date +'bot/cleanup-%s')"
|
|
|
|
id: create-branch-name
|
|
|
|
- run: |
|
|
|
|
git config user.name 'iptv-bot[bot]'
|
|
|
|
git config user.email '84861620+iptv-bot[bot]@users.noreply.github.com'
|
|
|
|
- run: git checkout -b ${{ steps.create-branch-name.outputs.branch_name }}
|
2021-12-12 05:08:31 +01:00
|
|
|
- run: npm install
|
|
|
|
- run: node scripts/commands/create-database.js
|
|
|
|
- run: node scripts/commands/cleanup-database.js
|
|
|
|
- run: node scripts/commands/update-playlists.js
|
2021-12-12 05:39:44 +01:00
|
|
|
- run: |
|
|
|
|
git add channels/*
|
|
|
|
git commit -m "[Bot] Update playlists"
|
2021-12-12 05:08:31 +01:00
|
|
|
- uses: tibdex/github-app-token@v1
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
id: create-app-token
|
2021-08-16 19:51:10 +02:00
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
2021-12-12 05:39:44 +01:00
|
|
|
- uses: repo-sync/pull-request@v2
|
2021-12-12 05:08:31 +01:00
|
|
|
if: ${{ github.ref == 'refs/heads/master' }}
|
2021-12-12 05:39:44 +01:00
|
|
|
id: pull-request
|
|
|
|
with:
|
|
|
|
github_token: ${{ steps.create-app-token.outputs.token }}
|
|
|
|
source_branch: ${{ steps.create-branch-name.outputs.branch_name }}
|
|
|
|
destination_branch: 'master'
|
|
|
|
pr_title: '[Bot] Remove broken links'
|
|
|
|
pr_body: |
|
|
|
|
This pull request is created by [cleanup][1] workflow.
|
2021-08-16 19:51:10 +02:00
|
|
|
|
2021-12-12 05:39:44 +01:00
|
|
|
[1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}
|