update #1404
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: update | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| jobs: | |
| main: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: tibdex/[email protected] | |
| 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.12.0' | |
| cache: 'npm' | |
| - name: install dependencies | |
| run: npm install | |
| - name: update data | |
| id: db-update | |
| run: | | |
| npm run db:update | |
| echo "processed_issues=$(cat temp/logs/update.log)" >> $GITHUB_OUTPUT | |
| - name: validate changes | |
| run: npm run db:validate | |
| - name: check if files are crlf | |
| uses: kforeverisback/check-crlf-extended@v2 | |
| continue-on-error: false | |
| with: | |
| directory: ./data | |
| line_ending_type: 'CRLF' | |
| include_pattern: '*.csv' | |
| pattern_type: 'shell_glob' | |
| - name: setup git | |
| run: | | |
| git config user.name "iptv-bot[bot]" | |
| git config user.email "84861620+iptv-bot[bot]@users.noreply.github.com" | |
| - run: git status | |
| - name: commit changes | |
| if: steps.db-update.outputs.processed_issues != 0 | |
| run: | | |
| git add data/*.csv | |
| git status | |
| 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.processed_issues }}" --no-verify | |
| - name: push all changes to the repository | |
| if: ${{ !env.ACT && github.ref == 'refs/heads/master' }} | |
| run: git push |