mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-11 17:40:03 -04:00
Merge pull request #20712 from iptv-org/freearhey-patch-3
This commit is contained in:
commit
43635ce494
1 changed files with 104 additions and 18 deletions
122
.github/workflows/format.yml
vendored
122
.github/workflows/format.yml
vendored
|
@ -2,14 +2,18 @@ name: format
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
# pull_request:
|
# pull_request:
|
||||||
# types:
|
# types: [closed]
|
||||||
# - closed
|
# branches:
|
||||||
|
# - master
|
||||||
|
# schedule:
|
||||||
|
# - cron: "0 12 * * *"
|
||||||
jobs:
|
jobs:
|
||||||
main:
|
on_trigger:
|
||||||
# if: ${{ github.event.pull_request.merged == true }}
|
# if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
- uses: tibdex/github-app-token@v1.8.2
|
- uses: tibdex/github-app-token@v1.8.2
|
||||||
|
@ -18,24 +22,20 @@ jobs:
|
||||||
with:
|
with:
|
||||||
app_id: ${{ secrets.APP_ID }}
|
app_id: ${{ secrets.APP_ID }}
|
||||||
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
if: ${{ !env.ACT }}
|
if: ${{ !env.ACT }}
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
token: ${{ steps.create-app-token.outputs.token }}
|
token: ${{ steps.create-app-token.outputs.token }}
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
if: ${{ !env.ACT }}
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: 'npm'
|
||||||
- name: setup git
|
- name: setup git
|
||||||
run: |
|
run: |
|
||||||
git config user.name "iptv-bot[bot]"
|
git config user.name "iptv-bot[bot]"
|
||||||
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
|
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
|
||||||
- uses: tj-actions/changed-files@v35
|
|
||||||
id: files
|
|
||||||
with:
|
|
||||||
files: streams/*.m3u
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
if: ${{ !env.ACT }}
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
cache: 'npm'
|
|
||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: format internal playlists
|
- name: format internal playlists
|
||||||
|
@ -44,12 +44,98 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
npm run playlist:lint
|
npm run playlist:lint
|
||||||
npm run playlist:validate
|
npm run playlist:validate
|
||||||
- run: git status
|
- name: changed files
|
||||||
- name: commit changes to /streams
|
id: files_after
|
||||||
|
run: |
|
||||||
|
FILES=streams/*.m3u
|
||||||
|
ANY_CHANGED=false
|
||||||
|
ALL_CHANGED_FILES=$(git diff --name-only "${FILES}" | tr '\n' ' ')
|
||||||
|
if [ -n "${ALL_CHANGED_FILES}" ]; then
|
||||||
|
ANY_CHANGED=true
|
||||||
|
fi
|
||||||
|
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: git status
|
||||||
|
run: git status
|
||||||
|
- name: commit changes
|
||||||
|
if: steps.files_after.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
git add streams
|
git add streams
|
||||||
git status
|
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
|
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
|
- name: push all changes to the repository
|
||||||
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
if: ${{ !env.ACT && github.ref == 'refs/heads/master' && steps.files_after.outputs.any_changed == 'true' }}
|
||||||
|
run: git push
|
||||||
|
on_merge:
|
||||||
|
if: github.event.pull_request.merged == true
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
- uses: tibdex/github-app-token@v1.8.2
|
||||||
|
if: ${{ !env.ACT }}
|
||||||
|
id: create-app-token
|
||||||
|
with:
|
||||||
|
app_id: ${{ secrets.APP_ID }}
|
||||||
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
if: ${{ !env.ACT }}
|
||||||
|
with:
|
||||||
|
fetch-depth: 2
|
||||||
|
token: ${{ steps.create-app-token.outputs.token }}
|
||||||
|
- name: changed files
|
||||||
|
id: files
|
||||||
|
run: |
|
||||||
|
FILES=streams/*.m3u
|
||||||
|
ANY_CHANGED=false
|
||||||
|
ALL_CHANGED_FILES=$(git diff --name-only "${FILES}" | tr '\n' ' ')
|
||||||
|
if [ -n "${ALL_CHANGED_FILES}" ]; then
|
||||||
|
ANY_CHANGED=true
|
||||||
|
fi
|
||||||
|
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
if: ${{ !env.ACT && steps.files.outputs.any_changed == 'true' }}
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
cache: 'npm'
|
||||||
|
- name: setup git
|
||||||
|
if: steps.files.outputs.any_changed == 'true'
|
||||||
|
run: |
|
||||||
|
git config user.name "iptv-bot[bot]"
|
||||||
|
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
|
||||||
|
- 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 }}
|
||||||
|
- name: git status
|
||||||
|
if: steps.files.outputs.any_changed == 'true'
|
||||||
|
run: git status
|
||||||
|
- name: changed files
|
||||||
|
id: files_after
|
||||||
|
run: |
|
||||||
|
FILES=streams/*.m3u
|
||||||
|
ANY_CHANGED=false
|
||||||
|
ALL_CHANGED_FILES=$(git diff --name-only "${FILES}" | tr '\n' ' ')
|
||||||
|
if [ -n "${ALL_CHANGED_FILES}" ]; then
|
||||||
|
ANY_CHANGED=true
|
||||||
|
fi
|
||||||
|
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: commit changes
|
||||||
|
if: steps.files_after.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_after.outputs.any_changed == 'true' }}
|
||||||
run: git push
|
run: git push
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue