From 3d556b8ff90d0eb16781d4db77bccf0d1eff3b1b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 21 Aug 2021 13:51:03 +0300 Subject: [PATCH 1/3] Update auto-update.yml --- .github/workflows/auto-update.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 99411305..8de4759f 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -50,6 +50,7 @@ jobs: name: .gh-pages path: .gh-pages/guides/${{ matrix.site }}.guide.xml deploy: + if: ${{ github.ref == 'refs/heads/master' }} needs: grab runs-on: ubuntu-latest steps: @@ -57,6 +58,12 @@ jobs: uses: actions/checkout@v2 - name: Download Artifacts uses: actions/download-artifact@v2 + - name: Generate Token + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@4.1.1 with: @@ -64,3 +71,7 @@ jobs: folder: .gh-pages target-folder: guides clean: false + token: ${{ steps.generate-token.outputs.token }} + git-config-name: iptv-bot + git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com + commit-message: '[Bot] Deploy to GitHub Pages' From a8dcd09f0a0b4edc63458a22593d996a428d1be4 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 21 Aug 2021 14:05:32 +0300 Subject: [PATCH 2/3] Update update-codes.yml --- .github/workflows/update-codes.yml | 69 ++++++++++++++++++++++-------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/.github/workflows/update-codes.yml b/.github/workflows/update-codes.yml index 640e0b82..90a17be1 100644 --- a/.github/workflows/update-codes.yml +++ b/.github/workflows/update-codes.yml @@ -4,11 +4,26 @@ on: schedule: - cron: '0 0 * * *' jobs: - update: + 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/update-codes' + update-codes: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: bot/update-codes - name: Install Dependencies run: npm install - name: Update Codes @@ -18,16 +33,36 @@ jobs: with: name: codes.csv path: codes.csv + commit-changes: + runs-on: ubuntu-latest + needs: update-codes + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: bot/update-codes + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + name: codes.csv + - name: Commit Changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: '[Bot] Update codes' + 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/update-codes + file_pattern: codes.csv pull-request: - needs: update + if: ${{ github.ref == 'refs/heads/master' }} + needs: commit-changes runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - - name: Download codes.csv - uses: actions/download-artifact@v2 with: - name: codes.csv + ref: bot/update-codes - name: Generate Token uses: tibdex/github-app-token@v1 id: generate-token @@ -36,26 +71,24 @@ jobs: private_key: ${{ secrets.APP_PRIVATE_KEY }} - name: Create Pull Request id: pr - uses: peter-evans/create-pull-request@v3 + uses: repo-sync/pull-request@v2 with: - title: '[Bot] Update codes' - body: | - This pull request is created automatically by `update-codes` action. - commit-message: '[Bot] Update codes' - committer: GitHub - branch: bot/update-codes - delete-branch: true - token: ${{ steps.generate-token.outputs.token }} + source_branch: 'bot/update-codes' + destination_branch: 'master' + pr_title: '[Bot] Update codes' + pr_body: | + This pull request is created by [update-codes][1] workflow. + + [1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }} + github_token: ${{ steps.generate-token.outputs.token }} - name: Enable Pull Request Automerge - if: steps.pr.outputs.pull-request-operation == 'created' uses: peter-evans/enable-pull-request-automerge@v1 with: token: ${{ secrets.PAT }} - pull-request-number: ${{ steps.pr.outputs.pull-request-number }} + pull-request-number: ${{ steps.pr.outputs.pr_number }} merge-method: squash - name: Approve Pull Request - if: steps.pr.outputs.pull-request-operation == 'created' uses: juliangruber/approve-pull-request-action@v1 with: github-token: ${{ secrets.PAT }} - number: ${{ steps.pr.outputs.pull-request-number }} + number: ${{ steps.pr.outputs.pr_number }} From 93a1180e308ee00550678ea012363b77739cec47 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 21 Aug 2021 14:06:59 +0300 Subject: [PATCH 3/3] Update update-codes.yml --- .github/workflows/update-codes.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/update-codes.yml b/.github/workflows/update-codes.yml index 90a17be1..a1bd3911 100644 --- a/.github/workflows/update-codes.yml +++ b/.github/workflows/update-codes.yml @@ -19,6 +19,7 @@ jobs: branch: 'bot/update-codes' update-codes: runs-on: ubuntu-latest + needs: create-branch steps: - name: Checkout uses: actions/checkout@v2