Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated the get-cloudflare.yml #24

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 41 additions & 27 deletions .github/workflows/get-cloudflare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,50 @@ name: GET Cloudflare

on:
schedule:
# At 6am every night
- cron: '0 6 * * *'
# Runs daily at 6 AM UTC
- cron: '0 6 * * *'

jobs:
get-data:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
- name: Fetch Cloudflare data
env:
CLOUDFLARE_ZONE_TAG: ${{ secrets.CLOUDFLARE_ZONE_TAG }}
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
run: npm run get-cloudflare
- name: check for changes
run: git status
- name: stage changed files
run: |
git config --local user.name "ocf-bot"
git config --local user.email "[email protected]"
git add .
git commit -m "🗃 Add latest cloudflare data"
- name: fetch from main
run: git fetch origin main
- name: push code to main
run: git push origin HEAD:main
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20.x'

- name: Install dependencies
run: npm install

- name: Fetch Cloudflare data
env:
CLOUDFLARE_ZONE_TAG: ${{ secrets.CLOUDFLARE_ZONE_TAG }}
CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }}
CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }}
run: npm run get-cloudflare

- name: Check for changes
run: |
git diff --quiet || echo "Changes detected"

- name: Configure Git
if: success()
run: |
git config --local user.name "ocf-bot"
git config --local user.email "[email protected]"

- name: Commit changes
if: success() && (run: git diff --quiet; echo $?)
run: |
git add .
git commit -m "🗃 Add latest Cloudflare data"

- name: Fetch latest changes from main
run: git pull --rebase origin main

- name: Push changes
run: git push origin HEAD:main