Skip to content

Update-Cumulative-Users #6

Update-Cumulative-Users

Update-Cumulative-Users #6

name: Update-Cumulative-Users
on:
schedule:
- cron: "55 04 * * *"
workflow_dispatch:
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9.x'
- name: Install backend dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Analytics
env:
CLOUDFLARE_ZONE_TAG: ${{ secrets.CLOUDFLARE_ZONE_TAG }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: |
python analytics.py
- name: Commit files
run: |
git add unique_visitors.csv cumulative_unique_visitors.png
git commit -m "Update unique visitors and cumulative visitors" || echo "No changes to commit"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update data
title: "Automated data update"
body: "This is an auto-generated update of the cumulative users data."
branch: "update-cumulative-users"
delete-branch: true
base: "main"
auto-merge:
needs: update-data
runs-on: ubuntu-latest
steps:
- name: Auto-merge
uses: pascalgn/[email protected]
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: "automerge"
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "pull-request-title"
MERGE_RETRIES: "6"
MERGE_RETRY_SLEEP: "10000"