Skip to content

better-cloudflare-ip #79

better-cloudflare-ip

better-cloudflare-ip #79

name: better-cloudflare-ip
on:
schedule:
- cron: '36 17 * * *'
workflow_dispatch:
repository_dispatch:
types: sync-better-cloudflare-ip
jobs:
repo-sync:
env:
PAT: ${{ secrets.PAT }}
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout the repository
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Check if branch exists
id: check_branch
run: |
if git show-ref --verify --quiet refs/heads/better-cloudflare-ip; then
echo "branch_exists=true" >> $GITHUB_ENV
else:
echo "branch_exists=false" >> $GITHUB_ENV
fi
- name: Delete existing branch
if: ${{ env.branch_exists == 'true' }}
run: |
git push origin --delete better-cloudflare-ip
- name: Create new branch
if: ${{ env.branch_exists == 'false' }}
run: |
git checkout -b better-cloudflare-ip
git push --set-upstream origin better-cloudflare-ip
- name: Sync branch
uses: repo-sync/github-sync@v2
if: env.PAT
with:
source_repo: "https://github.com/badafans/better-cloudflare-ip"
source_branch: "master"
destination_branch: "better-cloudflare-ip"
github_token: ${{ secrets.PAT }}