Skip to content

Repo sync

Repo sync #15

Workflow file for this run

name: Repo sync
on:
schedule:
# 6시간마다 실행
- cron: '0 */6 * * *'
workflow_dispatch:
inputs:
source_branch:
description: 'Source branch to sync from'
required: true
default: 'devel'
destination_branch:
description: 'Destination branch to sync to'
required: true
default: 'devel'
jobs:
repo-sync:
runs-on: [ code-linux, code-large ]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.source_branch || 'devel' }}
fetch-depth: 0
- name: Configure git
run: git config --global user.name "github-action[bot]"
- name: Force push to public github
env:
PUBLIC_PAT: ${{ secrets.PAT_TOKEN }}
run: |
SRC="${{ github.event.inputs.source_branch || 'devel' }}"
DEST="${{ github.event.inputs.destination_branch || 'devel' }}"
REMOTE_URL="https://rabbitfor:${{ secrets.PAT_TOKEN }}@github.com/dalihub/dali-ui.git"
MAX_RETRIES=3
RETRY_COUNT=0
SUCCESS=false
git remote add public "$REMOTE_URL"
until [ $RETRY_COUNT -ge $MAX_RETRIES ]
do
if git push public "$SRC:$DEST" --force; then
echo "Succeed"
SUCCESS=true
break
else
RETRY_COUNT=$((RETRY_COUNT+1))
echo "Retry after 5 sec..."
sleep 5
fi
done
if [ "$SUCCESS" = false ]; then
echo "Failed to push dalihub repo"
exit 1
fi