Skip to content

GitHub-Chinese-Top-Charts #66

GitHub-Chinese-Top-Charts

GitHub-Chinese-Top-Charts #66

name: GitHub-Chinese-Top-Charts
on:
schedule:
- cron: '17 11 * * *'
workflow_dispatch:
repository_dispatch:
types: sync-GitHub-Chinese-Top-Charts
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/GitHub-Chinese-Top-Charts; 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 GitHub-Chinese-Top-Charts
- name: Create new branch
if: ${{ env.branch_exists == 'false' }}
run: |
git checkout -b GitHub-Chinese-Top-Charts
git push --set-upstream origin GitHub-Chinese-Top-Charts
- name: Sync branch
uses: repo-sync/github-sync@v2
if: env.PAT
with:
source_repo: "https://github.com/GrowingGit/GitHub-Chinese-Top-Charts"
source_branch: "master"
destination_branch: "GitHub-Chinese-Top-Charts"
github_token: ${{ secrets.PAT }}