-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (38 loc) · 1.34 KB
/
push-to-starter-repo.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
name: Push Starter Project Subdirectory to Another Repo
on:
push:
branches:
- main
paths:
- "apps/next-wordpress-starter/**"
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Git Config
run: |
git config --global user.name 'GitHub Action Bot'
git config --global user.email 'action@github.com'
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key
sed -i 's/\\n/\n/g' private_key
chmod 600 private_key
ssh-keyscan github.com >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: Clone the destination repository using SSH
run: |
GIT_SSH_COMMAND="ssh -i private_key -o StrictHostKeyChecking=no" git clone git@github.com:CalebBarnes/nextwp-starter.git temp_repo
- name: Copy files to the temporary directory
run: |
rsync -av --exclude='.git' --delete apps/next-wordpress-starter/ temp_repo/
- name: Push to the destination repository
run: |
cd temp_repo
git add .
git commit -m "Mirrored from nextwp repository"
GIT_SSH_COMMAND="ssh -i ../private_key -o StrictHostKeyChecking=no" git push origin main