mirror of https://github.com/iptv-org/iptv
Create format.yml
parent
cf34de39f2
commit
c16627a3e7
@ -0,0 +1,67 @@
|
||||
name: format
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- closed
|
||||
jobs:
|
||||
main:
|
||||
if: ${{ github.event.pull_request.merged == true }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- uses: getsentry/action-github-app-token@v2
|
||||
if: ${{ !env.ACT }}
|
||||
id: create-app-token
|
||||
with:
|
||||
app_id: ${{ secrets.APP_ID }}
|
||||
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
- uses: actions/checkout@v3
|
||||
if: ${{ !env.ACT }}
|
||||
with:
|
||||
fetch-depth: 2
|
||||
token: ${{ steps.create-app-token.outputs.token }}
|
||||
- name: setup git
|
||||
run: |
|
||||
git config user.name "iptv-bot[bot]"
|
||||
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
|
||||
- uses: tj-actions/changed-files@v35
|
||||
id: files
|
||||
with:
|
||||
files: streams/*.m3u
|
||||
- name: download data from api
|
||||
if: ${{ !env.ACT && steps.files.outputs.any_changed == 'true' }}
|
||||
run: |
|
||||
mkdir -p temp/data
|
||||
curl -L -o temp/data/blocklist.json https://iptv-org.github.io/api/blocklist.json
|
||||
curl -L -o temp/data/channels.json https://iptv-org.github.io/api/channels.json
|
||||
- uses: actions/setup-node@v3
|
||||
if: ${{ !env.ACT && steps.files.outputs.any_changed == 'true' }}
|
||||
with:
|
||||
node-version: 18
|
||||
cache: 'npm'
|
||||
- name: install dependencies
|
||||
if: steps.files.outputs.any_changed == 'true'
|
||||
run: npm install
|
||||
- name: format internal playlists
|
||||
if: steps.files.outputs.any_changed == 'true'
|
||||
run: npm run playlist:format -- ${{ steps.files.outputs.all_changed_files }}
|
||||
- name: check internal playlists
|
||||
if: steps.files.outputs.any_changed == 'true'
|
||||
run: |
|
||||
npm run playlist:lint -- ${{ steps.files.outputs.all_changed_files }}
|
||||
npm run playlist:validate -- ${{ steps.files.outputs.all_changed_files }}
|
||||
- run: git status
|
||||
if: steps.files.outputs.any_changed == 'true'
|
||||
- name: commit changes to /streams
|
||||
if: steps.files.outputs.any_changed == 'true'
|
||||
run: |
|
||||
git add streams
|
||||
git status
|
||||
git commit -m "[Bot] Format /streams" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [format](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." --no-verify
|
||||
- name: push all changes to the repository
|
||||
if: ${{ !env.ACT && github.ref == 'refs/heads/master' && steps.files.outputs.any_changed == 'true' }}
|
||||
run: git push
|
Loading…
Reference in New Issue