iptv/.github/workflows/auto-update.yml
2021-08-03 08:23:04 +03:00

67 lines
2.0 KiB
YAML

name: auto-update
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
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/auto-update'
sort:
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: Sort Channels
run: node scripts/sort.js
- name: Commit Changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[Bot] Sort channels'
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/auto-update
file_pattern: channels/*
pull-request:
needs: sort
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: bot/auto-update
- 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: Create Pull Request
id: pr
uses: tretuna/sync-branches@1.2.0
with:
FROM_BRANCH: 'bot/auto-update'
TO_BRANCH: 'master'
PULL_REQUEST_TITLE: '[Bot] Update playlists'
PULL_REQUEST_BODY: |
This pull request is created by [auto-update][1] workflow.
[1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}