Update CSV and TXT Files #256
This file contains 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 CSV and TXT Files | |
on: | |
schedule: | |
- cron: '0 21 * * *' | |
workflow_dispatch: | |
jobs: | |
update-files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
cache-dependency-path: scripts/package-lock.json | |
- name: Change to scripts directory | |
run: cd scripts | |
- name: Install dependencies | |
run: | | |
cd scripts | |
npm ci | |
- name: Run main script | |
run: | | |
cd scripts | |
node main.js | |
env: | |
NOIP_USERNAME: ${{ secrets.NOIP_USERNAME }} | |
NOIP_PASSWORD: ${{ secrets.NOIP_PASSWORD }} | |
GSLB_USERNAME: ${{ secrets.GSLB_USERNAME }} | |
GSLB_PASSWORD: ${{ secrets.GSLB_PASSWORD }} | |
CLOUDDNS_USERNAME: ${{ secrets.CLOUDDNS_USERNAME }} | |
CLOUDDNS_PASSWORD: ${{ secrets.CLOUDDNS_PASSWORD }} | |
- name: Commit and push if there are changes | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add -A | |
git commit -m "Automatically update .csv and .txt files" || exit 0 | |
git push https://${{ secrets.ADMIN_GH_TOKEN }}@github.com/${{ github.repository }}.git |