-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 2.09 KB
/
Sync-from-AB-to-ABC.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Sync Directories and Files to ABC
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
sync-repo:
runs-on: ubuntu-latest
steps:
- name: Checkout AB repository
uses: actions/checkout@v3
with:
repository: Teahouse-Studios/akari-bot
path: akari-bot
- name: Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Sync directories and files
run: |
mkdir -p akari-bot-core
rsync -av --exclude='api/' 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/
rsync -av akari-bot/schedulers/ akari-bot-core/schedulers/
cp akari-bot/bot.py akari-bot-core/bot.py
cp akari-bot/console.py akari-bot-core/console.py
- name: Checkout ABC repository
uses: actions/checkout@v3
with:
repository: Teahouse-Studios/akari-bot-core
path: akari-bot-core
- name: Commit changes
run: |
cd akari-bot-core
git add .
if git diff --cached --quiet; then
echo "No changes detected, skipping commit."
exit 0
fi
git commit -m "Sync from AB repository on $(date +'%Y-%m-%d')"
# Push changes to a new branch
- name: Push changes to new branch
run: |
cd abc-repo
branch_name="sync-$(date +'%Y%m%d')"
git checkout -b $branch_name
git push origin $branch_name
# Create a pull request
- 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 AB repository on $(date +'%Y-%m-%d')"
body: |
This pull request contains changes synchronized from the AB repository.
Please review and merge.