From a79edce7b173fa322855c9d4ae5cc6ca161996fd Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 2 Aug 2021 04:13:25 +0300 Subject: [PATCH] Update auto-update.yml --- .github/workflows/auto-update.yml | 79 +++++++++++++++++++------------ 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 6c11b2d02b..79f12fb6f5 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -4,54 +4,64 @@ on: schedule: - cron: '0 0 * * *' jobs: - remove-duplicates: + create-branch: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 + - name: Create Branch + run: git branch bot/auto-update && git push + remove-duplicates: + runs-on: ubuntu-latest + needs: create-branch + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: bot/auto-update - name: Install Dependencies run: npm install - name: Remove Duplicates run: node scripts/remove-duplicates.js - - name: Upload Artifact - uses: actions/upload-artifact@v2 + - name: Commit Changes + uses: stefanzweifel/git-auto-commit-action@v4 with: - name: channels - path: channels/ + commit_message: '[Bot] Removed duplicates' + branch: bot/auto-update filter: runs-on: ubuntu-latest needs: remove-duplicates steps: - name: Checkout uses: actions/checkout@v2 - - name: Download Artifacts - uses: actions/download-artifact@v2 + with: + ref: bot/auto-update - name: Install Dependencies run: npm install - name: Filter Playlists run: node scripts/filter.js - - name: Upload Artifact - uses: actions/upload-artifact@v2 + - name: Commit Changes + uses: stefanzweifel/git-auto-commit-action@v4 with: - name: channels - path: channels/ + commit_message: '[Bot] Filtered channels' + branch: bot/auto-update format: runs-on: ubuntu-latest needs: filter steps: - name: Checkout uses: actions/checkout@v2 - - name: Download Artifacts - uses: actions/download-artifact@v2 + with: + ref: bot/auto-update - name: Install Dependencies run: npm install - name: Format Playlists run: node scripts/format.js - - name: Upload Artifact - uses: actions/upload-artifact@v2 + - name: Commit Changes + uses: stefanzweifel/git-auto-commit-action@v4 with: - name: channels - path: channels/ + commit_message: '[Bot] Formated playlists' + branch: bot/auto-update detect-resolution: runs-on: ubuntu-latest needs: format @@ -224,8 +234,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Download Artifacts - uses: actions/download-artifact@v2 + with: + ref: bot/auto-update - name: Install Dependencies run: npm install - name: Detect Resolution @@ -235,14 +245,29 @@ jobs: with: name: channels path: channels/${{ matrix.country }}.m3u - generate: + commit-changes: runs-on: ubuntu-latest needs: detect-resolution steps: - name: Checkout uses: actions/checkout@v2 + with: + ref: bot/auto-update - name: Download Artifacts uses: actions/download-artifact@v2 + - name: Commit Changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: '[Bot] Detected resolution' + branch: bot/auto-update + generate: + runs-on: ubuntu-latest + needs: commit-changes + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: bot/auto-update - name: Install Dependencies run: npm install - name: Generate Playlists @@ -258,8 +283,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Download Artifacts - uses: actions/download-artifact@v2 + with: + ref: bot/auto-update - name: Install Dependencies run: npm install - name: Update README.md @@ -275,15 +300,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - - name: Download /channels - uses: actions/download-artifact@v2 with: - name: channels - path: channels/ - - name: Download README.md - uses: actions/download-artifact@v2 - with: - name: README.md + ref: bot/auto-update - name: Generate Token uses: tibdex/github-app-token@v1 id: generate-token @@ -297,7 +315,6 @@ jobs: title: '[Bot] Update playlists' body: | This pull request is created automatically by `auto-update` action. - commit-message: '[Bot] Update playlists' committer: GitHub branch: bot/auto-update delete-branch: true