From f030410e60a15f5bc895bbb5fc99ce989c04da20 Mon Sep 17 00:00:00 2001 From: manhduonghn Date: Sun, 20 Aug 2023 17:20:24 +0700 Subject: [PATCH] Create upload.yml --- .github/workflows/upload.yml | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/upload.yml diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 0000000..c083d9a --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,41 @@ +name: Add Rules to Cloudflare Gateway +on: + workflow_dispatch: +jobs: + run: + name: Cloudflare Gateway + permissions: write-all + runs-on: ubuntu-latest + steps: + + - name: Checkout Repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: 3.11.3 + + - name: Install Dependencies + run: pip install -r requirements.txt + + - name: Set up Environment Variables + env: + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + + - name: Delete Older Rules + run: python -m src delete + + - name: Upload New Rules + run: python -m src upload + + - name: Delete workflow runs + uses: Mattraks/delete-workflow-runs@v2 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: 0 + keep_minimum_runs: 1