iptv/.github/workflows/auto-update.yml

135 lines
4.0 KiB
YAML
Raw Normal View History

2021-02-08 12:05:46 +01:00
name: auto-update
2021-02-08 11:53:24 +01:00
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
2021-05-26 14:58:54 +02:00
remove-duplicates:
2021-05-06 15:24:54 +02:00
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Dependencies
run: npm install
- name: Remove Duplicates
run: node scripts/remove-duplicates.js
2021-05-26 14:58:54 +02:00
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: channels
path: channels/
2021-07-13 18:18:04 +02:00
filter:
2021-05-26 14:58:54 +02:00
runs-on: ubuntu-latest
needs: remove-duplicates
2021-07-13 18:18:04 +02:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Install Dependencies
run: npm install
- name: Filter Playlists
run: node scripts/filter.js
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: channels
path: channels/
format:
runs-on: ubuntu-latest
needs: filter
2021-05-26 14:58:54 +02:00
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Install Dependencies
run: npm install
2021-02-08 11:53:24 +01:00
- name: Format Playlists
2021-05-07 02:37:00 +02:00
run: node scripts/format.js
2021-05-26 14:58:54 +02:00
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: channels
path: channels/
generate:
runs-on: ubuntu-latest
needs: format
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Install Dependencies
run: npm install
2021-02-08 11:53:24 +01:00
- name: Generate Playlists
run: node scripts/generate.js
- name: Deploy to GitHub Pages
2021-04-17 02:47:33 +02:00
uses: JamesIves/github-pages-deploy-action@4.1.1
2021-04-17 02:53:32 +02:00
with:
branch: gh-pages
folder: .gh-pages
2021-05-26 14:58:54 +02:00
update-readme:
runs-on: ubuntu-latest
needs: generate
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Install Dependencies
run: npm install
2021-02-08 11:53:24 +01:00
- name: Update README.md
run: node scripts/update-readme.js
2021-05-26 14:58:54 +02:00
- name: Upload Artifact
uses: actions/upload-artifact@v2
2021-05-26 14:37:13 +02:00
with:
2021-05-26 14:58:54 +02:00
name: README.md
path: README.md
2021-05-26 15:10:28 +02:00
pull-request:
needs: update-readme
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
2021-05-26 15:44:21 +02:00
- name: Download /channels
uses: actions/download-artifact@v2
with:
name: channels
2021-05-26 15:49:59 +02:00
path: channels/
2021-05-26 15:44:21 +02:00
- name: Download README.md
2021-05-26 15:10:28 +02:00
uses: actions/download-artifact@v2
2021-05-26 15:44:21 +02:00
with:
name: README.md
2021-05-26 17:23:27 +02: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-26 15:10:28 +02:00
- name: Create Pull Request
2021-05-26 16:16:58 +02:00
id: pr
2021-05-26 15:10:28 +02:00
uses: peter-evans/create-pull-request@v3
with:
title: '[Bot] Update playlists'
body: |
This pull request is created automatically by `auto-update` action.
commit-message: '[Bot] Update playlists'
2021-05-26 17:50:24 +02:00
committer: GitHub <noreply@github.com>
2021-05-26 15:10:28 +02:00
branch: bot/auto-update
delete-branch: true
2021-05-26 17:23:27 +02:00
token: ${{ steps.generate-token.outputs.token }}
- name: Enable Pull Request Automerge
2021-05-26 16:16:58 +02:00
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 }}
merge-method: squash
2021-05-26 16:44:04 +02:00
- 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 }}