From cd0d26d08a1a286a0af15d7054d8268e3fefb239 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 12 Dec 2021 07:08:31 +0300 Subject: [PATCH] Update cleanup.yml --- .github/workflows/cleanup.yml | 79 ++++++++++------------------------- 1 file changed, 23 insertions(+), 56 deletions(-) diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index a030d6bc67..fb7a67d447 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -2,65 +2,32 @@ name: cleanup on: workflow_dispatch: jobs: - create-branch: + cleanup: 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/cleanup' - remove-broken-links: - runs-on: ubuntu-latest - needs: create-branch - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: bot/cleanup - - name: Install Dependencies - run: npm install - - name: Remove Broken Links - run: node scripts/remove-broken-links.js - - name: Commit Changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: '[Bot] Remove broken links' - 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/cleanup - file_pattern: channels/* - pull-request: - if: ${{ github.ref == 'refs/heads/master' }} - runs-on: ubuntu-latest - needs: remove-broken-links - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - ref: bot/cleanup - - name: Generate Token - uses: tibdex/github-app-token@v1 - id: generate-token + - uses: actions/checkout@v2 + - run: npm install + - run: node scripts/commands/create-database.js + - run: node scripts/commands/cleanup-database.js + - run: node scripts/commands/update-playlists.js + - uses: tibdex/github-app-token@v1 + if: ${{ !env.ACT }} + id: create-app-token with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.APP_PRIVATE_KEY }} - - name: Create Pull Request - id: pr - uses: repo-sync/pull-request@v2 - with: - source_branch: 'bot/cleanup' - destination_branch: 'master' - pr_title: '[Bot] Cleaning playlists' - pr_body: | - This pull request is created by [cleanup][1] workflow. + - uses: peter-evans/create-pull-request@v3 + if: ${{ github.ref == 'refs/heads/master' }} + token: ${{ steps.create-app-token.outputs.token }} + commit-message: '[Bot] Update playlists' + committer: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>' + author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>' + branch: bot/cleanup + branch-suffix: timestamp + delete-branch: true + base: master + title: '[Bot] Remove broken links' + body: | + This pull request is created by [cleanup][1] workflow. - [1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }} - pr_draft: true - github_token: ${{ steps.generate-token.outputs.token }} + [1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}