Update topic application from URL #2397
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 topic application from URL | |
| on: | |
| schedule: | |
| # - cron: '0 17 * * *' # 0h (GMT+7) | |
| # - cron: '0 5 * * *' # 12h (GMT+7) | |
| - cron: '0 17,20,23,2,5,8,11,14 * * *' # Runs every 3 hours in GMT+7 | |
| jobs: | |
| update-topic-application: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| ref: main | |
| - name: Create topics directory if not exists | |
| run: mkdir -p topics | |
| - name: Fetch data from URL | |
| run: | | |
| curl -s https://tinyhref.com/launch/application/readme -o topics/application.md | |
| - name: Pull latest changes safely | |
| run: | | |
| if ! git diff --quiet; then | |
| git stash | |
| git pull --rebase origin main | |
| git stash pop || true | |
| else | |
| git pull --rebase origin main | |
| fi | |
| - name: Commit & Push Changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add topics/application.md | |
| git commit -m "🤖 auto-update" || exit 0 | |
| git push --force origin main |