Update country VN from URL #3379
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 country VN 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-country-VN: | |
| 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 countries | |
| - name: Fetch data from URL | |
| run: | | |
| curl -s https://tinyhref.com/launch/readme?country=VN -o countries/VN.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 countries/VN.md | |
| git commit -m "🤖 auto-update" || exit 0 | |
| git push --force origin main |