diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 97f49404e2..c215aab1c6 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,37 +1,42 @@ -name: check -on: - workflow_dispatch: - pull_request: - types: [opened, synchronize, reopened, edited] -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true -jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: changed files - id: files - run: | - git fetch origin master:master - 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: ${{ !env.ACT && steps.files.outputs.any_changed == 'true' }} - with: - node-version: 22 - cache: 'npm' - - name: install dependencies - if: steps.files.outputs.any_changed == 'true' - run: npm install - - name: validate - if: steps.files.outputs.any_changed == 'true' - run: | - npm run playlist:lint -- ${{ steps.files.outputs.all_changed_files }} +name: check +on: + workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened, edited] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Get list of changed files + id: files + run: | + git fetch origin master:master + 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 .npmrc for GitHub Packages + run: | + echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc + echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc + echo "always-auth=true" >> .npmrc + - name: Install dependencies + 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 }} \ No newline at end of file diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 439c21e9eb..7b7a5b82b4 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -1,131 +1,62 @@ -name: format -on: - workflow_dispatch: - # pull_request: - # types: [closed] - # branches: - # - master - # schedule: - # - cron: "0 12 * * *" -jobs: - on_trigger: - # if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} - if: ${{ github.event_name == 'workflow_dispatch' }} - 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 }} - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: 'npm' - - name: setup git - run: | - git config user.name "iptv-bot[bot]" - git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com" - - name: install dependencies - run: npm install - - name: format internal playlists - run: npm run playlist:format - - name: check internal playlists - run: | - npm run playlist:lint - npm run playlist:validate - - 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: git status - run: git status - - 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 - 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 +name: format +on: + workflow_dispatch: + # schedule: + # - cron: "0 12 * * *" +jobs: + on_trigger: + # if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }} + if: ${{ github.event_name == 'workflow_dispatch' }} + 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 }} + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Setup .npmrc for GitHub Packages + run: | + echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc + echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc + echo "always-auth=true" >> .npmrc + - name: Install dependencies + run: npm install + - name: Format internal playlists + run: npm run playlist:format + - name: Check internal playlists + run: | + npm run playlist:lint + npm run playlist:validate + - name: Get list of 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: Setup git + run: | + git config user.name "iptv-bot[bot]" + git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com" + - name: Commit changes to /streams + 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 \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 4bf3b0fae0..f305a4fd75 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,25 +1,26 @@ -name: stale -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * *' -permissions: - issues: write -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: tibdex/github-app-token@v1.8.2 - id: create-app-token - with: - app_id: ${{ secrets.APP_ID }} - private_key: ${{ secrets.APP_PRIVATE_KEY }} - - uses: actions/stale@v9 - with: - repo-token: ${{ steps.create-app-token.outputs.token }} - days-before-stale: 180 - days-before-close: 7 - operations-per-run: 500 - stale-issue-label: 'stale' - any-of-issue-labels: 'channel search' +name: stale +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' +permissions: + actions: write + issues: write +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: tibdex/github-app-token@v1.8.2 + id: create-app-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} + - uses: actions/stale@v9 + with: + repo-token: ${{ steps.create-app-token.outputs.token }} + days-before-stale: 180 + days-before-close: 7 + operations-per-run: 500 + 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.' \ No newline at end of file diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index a44b59538b..82928fac93 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -1,82 +1,85 @@ -name: update -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * *' -jobs: - main: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - 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@v3 - if: ${{ !env.ACT }} - with: - 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: actions/setup-node@v3 - if: ${{ !env.ACT }} - with: - node-version: 20 - cache: 'npm' - - name: install dependencies - run: npm install - - name: update internal playlists - run: npm run playlist:update --silent >> $GITHUB_OUTPUT - id: playlist-update - - name: check internal playlists - run: | - npm run playlist:lint - npm run playlist:validate - - name: generate public playlists - run: npm run playlist:generate - - name: generate .api/streams.json - run: npm run api:generate - - name: update readme - run: npm run readme:update - - run: git status - - name: commit changes to /streams - run: | - git add streams - git status - 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 - - name: commit changes to playlists.md - run: | - git add PLAYLISTS.md - git status - 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: push all changes to the repository - if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} - run: git push - - name: deploy public playlists to github pages - uses: JamesIves/github-pages-deploy-action@4.1.1 - if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} - with: - repository-name: iptv-org/iptv - branch: gh-pages - folder: .gh-pages - token: ${{ steps.create-app-token.outputs.token }} - git-config-name: iptv-bot[bot] - git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com - commit-message: '[Bot] Deploy to GitHub Pages' - clean: true - - name: move .api/streams.json to iptv-org/api - uses: JamesIves/github-pages-deploy-action@4.1.1 - if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} - with: - repository-name: iptv-org/api - branch: gh-pages - folder: .api - token: ${{ steps.create-app-token.outputs.token }} - 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 +name: update +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' +jobs: + main: + 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 }} + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'npm' + - name: Setup .npmrc for GitHub Packages + run: | + echo "//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN" >> .npmrc + echo "@iptv-org:registry=https://npm.pkg.github.com/" >> .npmrc + echo "always-auth=true" >> .npmrc + - name: Install dependencies + run: npm install + - name: Update internal playlists + run: npm run playlist:update --silent >> $GITHUB_OUTPUT + id: playlist-update + - name: Check internal playlists + run: | + npm run playlist:lint + npm run playlist:validate + - name: Generate public playlists + run: npm run playlist:generate + - name: Generate .api/streams.json + run: npm run api:generate + - name: Update readme + run: npm run readme:update + - name: Setup git + run: | + git config user.name "iptv-bot[bot]" + git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com" + - name: Commit changes to /streams + run: | + git add streams + git status + 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 + - name: Commit changes to PLAYLIST.md + run: | + git add PLAYLISTS.md + git status + 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: Push all changes to the repository + if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} + run: git push + - name: Deploy public playlists to GitHub Pages + uses: JamesIves/github-pages-deploy-action@4.1.1 + if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} + with: + repository-name: iptv-org/iptv + branch: gh-pages + folder: .gh-pages + token: ${{ steps.create-app-token.outputs.token }} + git-config-name: iptv-bot[bot] + git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com + commit-message: '[Bot] Deploy to GitHub Pages' + clean: true + - name: Move .api/streams.json to iptv-org/api + uses: JamesIves/github-pages-deploy-action@4.1.1 + if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} + with: + repository-name: iptv-org/api + branch: gh-pages + folder: .api + token: ${{ steps.create-app-token.outputs.token }} + 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