mirror of
https://github.com/iptv-org/epg
synced 2025-12-17 02:47:02 -05:00
Update .github/workflows
This commit is contained in:
35
.github/workflows/check.yml
vendored
35
.github/workflows/check.yml
vendored
@@ -8,21 +8,23 @@ on:
|
|||||||
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
|
||||||
|
permissions:
|
||||||
|
packages: read
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
main:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
- name: Get list of changed files
|
||||||
fetch-depth: 2
|
|
||||||
- name: changed files
|
|
||||||
id: files
|
id: files
|
||||||
run: |
|
run: |
|
||||||
git fetch origin master:master
|
git fetch origin master:master
|
||||||
|
ANY_CHANGED=false
|
||||||
JS_ANY_CHANGED=false
|
JS_ANY_CHANGED=false
|
||||||
JS_ALL_CHANGED_FILES=$(git diff --name-only master -- tests/**/*.js tests/**/*.ts scripts/**/*.js scripts/**/*.mts scripts/**/*.ts sites/**/*.js sites/**/*.ts | tr '\n' ' ')
|
JS_ALL_CHANGED_FILES=$(git diff --name-only master -- tests/**/*.js tests/**/*.ts scripts/**/*.js scripts/**/*.mts scripts/**/*.ts sites/**/*.js sites/**/*.ts | tr '\n' ' ')
|
||||||
if [ -n "${JS_ALL_CHANGED_FILES}" ]; then
|
if [ -n "${JS_ALL_CHANGED_FILES}" ]; then
|
||||||
JS_ANY_CHANGED=true
|
JS_ANY_CHANGED=true
|
||||||
|
ANY_CHANGED=true
|
||||||
fi
|
fi
|
||||||
echo "js_all_changed_files=$JS_ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
echo "js_all_changed_files=$JS_ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
echo "js_any_changed=$JS_ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
echo "js_any_changed=$JS_ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
@@ -30,24 +32,31 @@ jobs:
|
|||||||
CHANNELS_ALL_CHANGED_FILES=$(git diff --name-only master -- sites/**/*.channels.xml | tr '\n' ' ')
|
CHANNELS_ALL_CHANGED_FILES=$(git diff --name-only master -- sites/**/*.channels.xml | tr '\n' ' ')
|
||||||
if [ -n "${CHANNELS_ALL_CHANGED_FILES}" ]; then
|
if [ -n "${CHANNELS_ALL_CHANGED_FILES}" ]; then
|
||||||
CHANNELS_ANY_CHANGED=true
|
CHANNELS_ANY_CHANGED=true
|
||||||
|
ANY_CHANGED=true
|
||||||
fi
|
fi
|
||||||
echo "channels_all_changed_files=$CHANNELS_ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
echo "channels_all_changed_files=$CHANNELS_ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
echo "channels_any_changed=$CHANNELS_ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
echo "channels_any_changed=$CHANNELS_ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "any_changed=$ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
if: ${{ steps.files.outputs.js_any_changed == 'true' || steps.files.outputs.channels_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.js_any_changed == 'true' || steps.files.outputs.channels_any_changed == 'true'
|
if: steps.files.outputs.any_changed == 'true'
|
||||||
run: SKIP_POSTINSTALL=1 npm install
|
|
||||||
- name: check changed js-files
|
|
||||||
if: steps.files.outputs.js_any_changed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
npx eslint ${{ steps.files.outputs.js_all_changed_files }}
|
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
|
||||||
- name: check changed *.channels.xml
|
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: SKIP_POSTINSTALL=1 npm install
|
||||||
|
- name: Check changed js-files
|
||||||
|
if: steps.files.outputs.js_any_changed == 'true'
|
||||||
|
run: npx eslint ${{ steps.files.outputs.js_all_changed_files }}
|
||||||
|
- name: Check changed *.channels.xml files
|
||||||
if: steps.files.outputs.channels_any_changed == 'true'
|
if: steps.files.outputs.channels_any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
npm run channels:lint -- ${{ steps.files.outputs.channels_all_changed_files }}
|
|
||||||
npm run postinstall
|
npm run postinstall
|
||||||
|
npm run channels:lint -- ${{ steps.files.outputs.channels_all_changed_files }}
|
||||||
npm run channels:validate -- ${{ steps.files.outputs.channels_all_changed_files }}
|
npm run channels:validate -- ${{ steps.files.outputs.channels_all_changed_files }}
|
||||||
64
.github/workflows/format.yml
vendored
Normal file
64
.github/workflows/format.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
name: format
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
# schedule:
|
||||||
|
# - cron: "0 12 * * *"
|
||||||
|
permissions:
|
||||||
|
packages: read
|
||||||
|
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=${{ secrets.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 *.channels.xml files
|
||||||
|
run: npm run channels:format
|
||||||
|
- name: Get list of changed *.channels.xml files
|
||||||
|
id: files
|
||||||
|
run: |
|
||||||
|
git fetch origin master:master
|
||||||
|
CHANNELS_ANY_CHANGED=false
|
||||||
|
CHANNELS_ALL_CHANGED_FILES=$(git diff --name-only master -- sites/**/*.channels.xml | tr '\n' ' ')
|
||||||
|
if [ -n "${CHANNELS_ALL_CHANGED_FILES}" ]; then
|
||||||
|
CHANNELS_ANY_CHANGED=true
|
||||||
|
fi
|
||||||
|
echo "channels_all_changed_files=$CHANNELS_ALL_CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "channels_any_changed=$CHANNELS_ANY_CHANGED" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: Check changed *.channels.xml files
|
||||||
|
if: steps.files.outputs.channels_any_changed == 'true'
|
||||||
|
run: |
|
||||||
|
npm run channels:lint -- ${{ steps.files.outputs.channels_all_changed_files }}
|
||||||
|
npm run channels:validate -- ${{ steps.files.outputs.channels_all_changed_files }}
|
||||||
|
- 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 changed *.channels.xml files
|
||||||
|
if: steps.files_after.outputs.channels_any_changed == 'true'
|
||||||
|
run: |
|
||||||
|
git add streams
|
||||||
|
git status
|
||||||
|
git commit -m "[Bot] Format *.channels.xml files" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [format](https://github.com/iptv-org/epg/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.channels_any_changed == 'true' }}
|
||||||
|
run: git push
|
||||||
3
.github/workflows/update.yml
vendored
3
.github/workflows/update.yml
vendored
@@ -29,8 +29,7 @@ jobs:
|
|||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: check *.channels.xml
|
- name: check *.channels.xml
|
||||||
run: |
|
run: npm run channels:lint
|
||||||
npm run channels:lint
|
|
||||||
- name: update sites.md
|
- name: update sites.md
|
||||||
run: npm run sites:update
|
run: npm run sites:update
|
||||||
- run: git status
|
- run: git status
|
||||||
|
|||||||
Reference in New Issue
Block a user