42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
name: Sync Cloudflare DNS
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
sync:
|
|
if: github.event_name == 'push' || github.event.pull_request.merged == true
|
|
runs-on: ubuntu-latest
|
|
|
|
concurrency:
|
|
group: dns-sync
|
|
cancel-in-progress: false
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Capture changes
|
|
run: |
|
|
if [ "${{ github.event_name }}" == "pull_request" ]; then
|
|
git diff --name-status ${{ github.event.pull_request.base.sha }} ${{ github.sha }} > changes.txt
|
|
else
|
|
git diff --name-status ${{ github.event.before }} ${{ github.sha }} > changes.txt
|
|
fi
|
|
echo "Changes detected:"
|
|
cat changes.txt
|
|
|
|
- name: Sync DNS
|
|
env:
|
|
CF_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
|
CF_ZONE_ID: ${{ secrets.CF_ZONE_ID }}
|
|
CF_DOMAIN: ${{ secrets.CF_DOMAIN }}
|
|
run: |
|
|
node scripts/sync-dns.js
|