Update workflows

This commit is contained in:
freearhey
2025-10-08 21:26:10 +03:00
parent 3cb2edd94f
commit 40221ab2d2
4 changed files with 213 additions and 273 deletions

View File

@@ -1,37 +1,42 @@
name: check name: check
on: on:
workflow_dispatch: workflow_dispatch:
pull_request: pull_request:
types: [opened, synchronize, reopened, edited] types: [opened, synchronize, reopened, edited]
concurrency: concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true cancel-in-progress: true
jobs: jobs:
check: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: changed files - name: Get list of changed files
id: files id: files
run: | run: |
git fetch origin master:master git fetch origin master:master
ANY_CHANGED=false ANY_CHANGED=false
ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | tr '\n' ' ') ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | tr '\n' ' ')
if [ -n "${ALL_CHANGED_FILES}" ]; then if [ -n "${ALL_CHANGED_FILES}" ]; then
ANY_CHANGED=true ANY_CHANGED=true
fi fi
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT" echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT" echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
if: ${{ !env.ACT && steps.files.outputs.any_changed == 'true' }} if: steps.files.outputs.any_changed == 'true'
with: with:
node-version: 22 node-version: 22
cache: 'npm' cache: 'npm'
- name: install dependencies - name: Setup .npmrc for GitHub Packages
if: steps.files.outputs.any_changed == 'true' run: |
run: npm install echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc
- name: validate echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc
if: steps.files.outputs.any_changed == 'true' echo "always-auth=true" >> .npmrc
run: | - name: Install dependencies
npm run playlist:lint -- ${{ steps.files.outputs.all_changed_files }} if: steps.files.outputs.any_changed == 'true'
run: npm install
- name: Validate changed files
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 }} npm run playlist:validate -- ${{ steps.files.outputs.all_changed_files }}

View File

@@ -1,131 +1,62 @@
name: format name: format
on: on:
workflow_dispatch: workflow_dispatch:
# pull_request: # schedule:
# types: [closed] # - cron: "0 12 * * *"
# branches: jobs:
# - master on_trigger:
# schedule: # if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
# - cron: "0 12 * * *" if: ${{ github.event_name == 'workflow_dispatch' }}
jobs: runs-on: ubuntu-latest
on_trigger: steps:
# if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} - uses: actions/checkout@v4
if: ${{ github.event_name == 'workflow_dispatch' }} - uses: tibdex/github-app-token@v1.8.2
runs-on: ubuntu-latest if: ${{ !env.ACT }}
steps: id: create-app-token
- uses: actions/checkout@v4 with:
- uses: tibdex/github-app-token@v1.8.2 app_id: ${{ secrets.APP_ID }}
if: ${{ !env.ACT }} private_key: ${{ secrets.APP_PRIVATE_KEY }}
id: create-app-token - uses: actions/checkout@v4
with: if: ${{ !env.ACT }}
app_id: ${{ secrets.APP_ID }} with:
private_key: ${{ secrets.APP_PRIVATE_KEY }} token: ${{ steps.create-app-token.outputs.token }}
- uses: actions/checkout@v4 - uses: actions/setup-node@v4
if: ${{ !env.ACT }} with:
with: node-version: 22
token: ${{ steps.create-app-token.outputs.token }} cache: 'npm'
- uses: actions/setup-node@v4 - name: Setup .npmrc for GitHub Packages
with: run: |
node-version: 22 echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc
cache: 'npm' echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc
- name: setup git echo "always-auth=true" >> .npmrc
run: | - name: Install dependencies
git config user.name "iptv-bot[bot]" run: npm install
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com" - name: Format internal playlists
- name: install dependencies run: npm run playlist:format
run: npm install - name: Check internal playlists
- name: format internal playlists run: |
run: npm run playlist:format npm run playlist:lint
- name: check internal playlists npm run playlist:validate
run: | - name: Get list of changed files
npm run playlist:lint id: files_after
npm run playlist:validate run: |
- name: changed files ANY_CHANGED=false
id: files_after ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | tr '\n' ' ')
run: | if [ -n "${ALL_CHANGED_FILES}" ]; then
ANY_CHANGED=false ANY_CHANGED=true
ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | tr '\n' ' ') fi
if [ -n "${ALL_CHANGED_FILES}" ]; then echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
ANY_CHANGED=true echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
fi - name: Setup git
echo "all_changed_files=$ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT" run: |
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT" git config user.name "iptv-bot[bot]"
- name: git status git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
run: git status - name: Commit changes to /streams
- name: commit changes if: steps.files_after.outputs.any_changed == 'true'
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' && steps.files_after.outputs.any_changed == 'true' }}
if: ${{ !env.ACT && github.ref == 'refs/heads/master' && steps.files_after.outputs.any_changed == 'true' }} run: git push
run: git push
on_merge:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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:
token: ${{ steps.create-app-token.outputs.token }}
- name: changed files
id: files
run: |
ANY_CHANGED=false
ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | 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: ${{ 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: |
ANY_CHANGED=false
ALL_CHANGED_FILES=$(git diff --name-only master -- streams/ | 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

View File

@@ -1,25 +1,26 @@
name: stale name: stale
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
permissions: permissions:
issues: write actions: write
jobs: issues: write
stale: jobs:
runs-on: ubuntu-latest stale:
steps: runs-on: ubuntu-latest
- uses: tibdex/github-app-token@v1.8.2 steps:
id: create-app-token - uses: tibdex/github-app-token@v1.8.2
with: id: create-app-token
app_id: ${{ secrets.APP_ID }} with:
private_key: ${{ secrets.APP_PRIVATE_KEY }} app_id: ${{ secrets.APP_ID }}
- uses: actions/stale@v9 private_key: ${{ secrets.APP_PRIVATE_KEY }}
with: - uses: actions/stale@v9
repo-token: ${{ steps.create-app-token.outputs.token }} with:
days-before-stale: 180 repo-token: ${{ steps.create-app-token.outputs.token }}
days-before-close: 7 days-before-stale: 180
operations-per-run: 500 days-before-close: 7
stale-issue-label: 'stale' operations-per-run: 500
any-of-issue-labels: 'channel search' stale-issue-label: 'stale'
any-of-issue-labels: 'channel search'
close-issue-message: 'This request has been closed because it has been inactive for more than 180 days.' close-issue-message: 'This request has been closed because it has been inactive for more than 180 days.'

View File

@@ -1,82 +1,85 @@
name: update name: update
on: on:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '0 0 * * *' - cron: '0 0 * * *'
jobs: jobs:
main: main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: tibdex/github-app-token@v1.8.2 - uses: tibdex/github-app-token@v1.8.2
if: ${{ !env.ACT }} if: ${{ !env.ACT }}
id: create-app-token id: create-app-token
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:
token: ${{ steps.create-app-token.outputs.token }} token: ${{ steps.create-app-token.outputs.token }}
- name: setup git - uses: actions/setup-node@v4
run: | with:
git config user.name "iptv-bot[bot]" node-version: 22
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com" cache: 'npm'
- uses: actions/setup-node@v3 - name: Setup .npmrc for GitHub Packages
if: ${{ !env.ACT }} run: |
with: echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc
node-version: 20 echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc
cache: 'npm' echo "always-auth=true" >> .npmrc
- name: install dependencies - name: Install dependencies
run: npm install run: npm install
- name: update internal playlists - name: Update internal playlists
run: npm run playlist:update --silent >> $GITHUB_OUTPUT run: npm run playlist:update --silent >> $GITHUB_OUTPUT
id: playlist-update id: playlist-update
- name: check internal playlists - name: Check internal playlists
run: | run: |
npm run playlist:lint npm run playlist:lint
npm run playlist:validate npm run playlist:validate
- name: generate public playlists - name: Generate public playlists
run: npm run playlist:generate run: npm run playlist:generate
- name: generate .api/streams.json - name: Generate .api/streams.json
run: npm run api:generate run: npm run api:generate
- name: update readme - name: Update readme
run: npm run readme:update run: npm run readme:update
- run: git status - name: Setup git
- name: commit changes to /streams run: |
run: | git config user.name "iptv-bot[bot]"
git add streams git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
git status - name: Commit changes to /streams
git commit --allow-empty -m "[Bot] Update /streams" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." -m "${{ steps.playlist-update.outputs.OUTPUT }}" --no-verify run: |
- name: commit changes to playlists.md git add streams
run: | git status
git add PLAYLISTS.md git commit --allow-empty -m "[Bot] Update /streams" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." -m "${{ steps.playlist-update.outputs.OUTPUT }}" --no-verify
git status - name: Commit changes to PLAYLIST.md
git commit --allow-empty -m "[Bot] Update PLAYLISTS.md" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." --no-verify run: |
- name: push all changes to the repository git add PLAYLISTS.md
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} git status
run: git push git commit --allow-empty -m "[Bot] Update PLAYLISTS.md" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}) workflow." --no-verify
- name: deploy public playlists to github pages - name: Push all changes to the repository
uses: JamesIves/github-pages-deploy-action@4.1.1 if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} run: git push
with: - name: Deploy public playlists to GitHub Pages
repository-name: iptv-org/iptv uses: JamesIves/github-pages-deploy-action@4.1.1
branch: gh-pages if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
folder: .gh-pages with:
token: ${{ steps.create-app-token.outputs.token }} repository-name: iptv-org/iptv
git-config-name: iptv-bot[bot] branch: gh-pages
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com folder: .gh-pages
commit-message: '[Bot] Deploy to GitHub Pages' token: ${{ steps.create-app-token.outputs.token }}
clean: true git-config-name: iptv-bot[bot]
- name: move .api/streams.json to iptv-org/api git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
uses: JamesIves/github-pages-deploy-action@4.1.1 commit-message: '[Bot] Deploy to GitHub Pages'
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} clean: true
with: - name: Move .api/streams.json to iptv-org/api
repository-name: iptv-org/api uses: JamesIves/github-pages-deploy-action@4.1.1
branch: gh-pages if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
folder: .api with:
token: ${{ steps.create-app-token.outputs.token }} repository-name: iptv-org/api
git-config-name: iptv-bot[bot] branch: gh-pages
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com folder: .api
commit-message: '[Bot] Deploy to iptv-org/api' token: ${{ steps.create-app-token.outputs.token }}
clean: false git-config-name: iptv-bot[bot]
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
commit-message: '[Bot] Deploy to iptv-org/api'
clean: false