Skip to content

Cloudflare Settings Automation #18

Cloudflare Settings Automation

Cloudflare Settings Automation #18

name: Cloudflare Settings Automation
on:
workflow_dispatch: # Allows manual triggering from GitHub Actions UI
jobs:
apply-settings:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --force-reinstall aiohttp pydantic cloudflare tenacity pyyaml
continue-on-error: false # Stop the workflow if dependencies fail to install
- name: Verify configuration file
run: |
if [ ! -f config/cloudflare.yaml ]; then
echo "::error::Configuration file not found at config/cloudflare.yaml"
exit 1
fi
continue-on-error: false # Stop the workflow if the configuration file is not found
- name: Set environment variables
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_FQDN: ${{ secrets.CLOUDFLARE_FQDN }}
run: echo "Environment variables set."
- name: Run Cloudflare script
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
CLOUDFLARE_FQDN: ${{ secrets.CLOUDFLARE_FQDN }}
run: python scripts/apply_cloudflare.py --config config/cloudflare.yaml
continue-on-error: false # Stop the workflow if the script execution fails
- name: Cleanup and feedback
if: failure()
run: echo "::error::Workflow failed at some steps. Please check the logs."