Skip to content

Sync Directories and Files #3

Sync Directories and Files

Sync Directories and Files #3

Workflow file for this run

name: Sync Directories and Files
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
sync-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout Source repository
uses: actions/checkout@v3
with:
repository: Teahouse-Studios/akari-bot
path: akari-bot
- name: Checkout Target repository
uses: actions/checkout@v3
with:
repository: Teahouse-Studios/akari-bot-core
path: akari-bot-core
token: ${{ secrets.GITHUB_TOKEN }}
- name: Sync directories and files
run: |
mkdir -p akari-bot-core
rsync -av akari-bot/bots/ akari-bot-core/bots/
rsync -av akari-bot/core/ akari-bot-core/core/
rsync -av akari-bot/modules/core/ akari-bot-core/modules/core/
cp akari-bot/schedulers/purge.py akari-bot-core/schedulers/
cp akari-bot/bot.py akari-bot-core/
cp akari-bot/console.py akari-bot-core/
- name: Commit changes
run: |
cd akari-bot-core
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
if git diff --cached --quiet; then
echo "No changes detected, skipping commit."
exit 0
fi
git commit -m "Sync from source repository on $(date +'%Y-%m-%d')"
- name: Push changes to new branch
id: push-changes
run: |
cd akari-bot-core
branch_name="sync-$(date +'%Y%m%d')"
git checkout -b $branch_name
git push origin $branch_name
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ steps.push-changes.outputs.branch_name }}
title: "Sync from source repository on $(date +'%Y-%m-%d')"
body: |
This pull request contains changes synchronized from the source repository.
Please review and merge.
base: main