2023-04-08 20:39:08 -04:00
|
|
|
name: update
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2023-04-11 17:50:43 -04:00
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
2023-04-08 20:39:08 -04:00
|
|
|
jobs:
|
|
|
|
main:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-10-06 22:59:05 -04:00
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: tibdex/github-app-token@v1.8.2
|
|
|
|
if: ${{ !env.ACT }}
|
2023-04-08 20:39:08 -04:00
|
|
|
id: create-app-token
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
2023-05-25 12:39:17 -04:00
|
|
|
- uses: actions/checkout@v3
|
2023-10-06 22:59:05 -04:00
|
|
|
if: ${{ !env.ACT }}
|
2023-05-25 12:39:17 -04:00
|
|
|
with:
|
|
|
|
token: ${{ steps.create-app-token.outputs.token }}
|
2023-10-06 22:59:05 -04:00
|
|
|
- uses: actions/setup-node@v3
|
|
|
|
if: ${{ !env.ACT }}
|
|
|
|
with:
|
|
|
|
node-version: 18
|
|
|
|
cache: 'npm'
|
|
|
|
- name: install dependencies
|
|
|
|
run: npm install
|
|
|
|
- name: update data
|
|
|
|
id: db-update
|
|
|
|
run: npm run db:update --silent >> $GITHUB_OUTPUT
|
|
|
|
- name: validate changes
|
2023-05-25 12:43:16 -04:00
|
|
|
run: npm run db:validate
|
2023-10-06 22:59:05 -04:00
|
|
|
- name: setup git
|
2023-05-24 16:37:02 -04:00
|
|
|
run: |
|
2023-05-26 00:34:37 -04:00
|
|
|
git config user.name "iptv-bot[bot]"
|
|
|
|
git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com"
|
2023-10-06 22:59:05 -04:00
|
|
|
- run: git status
|
|
|
|
- name: commit changes
|
|
|
|
if: steps.db-update.outputs.OUTPUT != 0
|
|
|
|
run: |
|
|
|
|
git add data/*.csv
|
2023-05-24 16:37:02 -04:00
|
|
|
git status
|
2023-10-06 22:59:05 -04:00
|
|
|
git commit -m "[Bot] Update data" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [update](https://github.com/iptv-org/database/actions/runs/${{ github.run_id }}) workflow." -m "${{ steps.db-update.outputs.OUTPUT }}" --no-verify
|
|
|
|
- name: push all changes to the repository
|
|
|
|
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
|
|
run: git push
|