Data update #1078
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: Data update | |
| on: | |
| schedule: | |
| - cron: '0 16 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| outputs: | |
| has_update: ${{ steps.update.outputs.has_update }} | |
| steps: | |
| - name: Checkout data branch | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: data | |
| fetch-depth: 2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| - name: Prepare fetcher | |
| uses: dsaltares/fetch-gh-release-asset@master | |
| with: | |
| repo: xingrz/teleconan-fetcher | |
| file: teleconan-fetcher.tgz | |
| token: ${{ secrets.FETCHER_TOKEN }} | |
| - name: Install and run | |
| id: update | |
| run: | | |
| npm install --no-save teleconan-fetcher.tgz | |
| node node_modules/teleconan-fetcher | |
| rm -rf node_modules teleconan-fetcher.tgz | |
| git diff | |
| if [[ -z "$(git status --porcelain)" ]]; then | |
| echo "No update" | |
| echo "No update" > $GITHUB_STEP_SUMMARY | |
| else | |
| echo "has_update=yes" >> $GITHUB_OUTPUT | |
| echo "```diff" > $GITHUB_STEP_SUMMARY | |
| git diff >> $GITHUB_STEP_SUMMARY | |
| echo "```" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| - name: Publish | |
| if: steps.update.outputs.has_update == 'yes' | |
| run: | | |
| git config user.name "Teleconan Fetcher" | |
| git config user.email "xingrz@users.noreply.github.com" | |
| git add -A | |
| git commit -m "Auto data update via workflow run ${{ github.run_id }}" | |
| git pull origin data --depth 10 --rebase | |
| git push origin data | |
| deploy: | |
| if: needs.update.outputs.has_update == 'yes' | |
| needs: update | |
| uses: ./.github/workflows/deploy.yml | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write |