Skip to content

Update push-to-starter-repo.yml #12

Update push-to-starter-repo.yml

Update push-to-starter-repo.yml #12

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: |
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
env:
GIT_SSH_COMMAND: ssh -i private_key -o StrictHostKeyChecking=no
- name: Clone the destination repository using SSH
run: |
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 push origin main
# name: Push Starter Project Subdirectory to Another Repo
# on:
# push:
# branches:
# - main
# # paths:
# # - "apps/next-wordpress-starter/**"
# permissions: write-all
# jobs:
# push:
# runs-on: ubuntu-latest
# steps:
# - name: Test printing a non-sensitive secret
# run: echo "Test secret is ${{ secrets.TEST }}"
# - uses: actions/checkout@v3
# with:
# # token: ${{ secrets.GITHUB_TOKEN }}
# # ref: ${{ github.head_ref }}
# fetch-depth: 0
# - name: Push to another repository
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.PAT }}
# repository: CalebBarnes/nextwp-starter
# directory: apps/next-wordpress-starter
# branch: main
# force: true