Skip to content

Use PAT username auth for internal sync #3

Use PAT username auth for internal sync

Use PAT username auth for internal sync #3

name: Sync Public to Private
on:
push:
branches:
- main # Triggers whenever code is pushed or merged into public main
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout Public Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Push to Private Repo
env:
SYNC_TOKEN: ${{ secrets.SYNC_TOKEN }}
SYNC_USER: ${{ github.actor }}
run: |
# Configure Git identities
git config --global user.name "GitHub Action Bot"
git config --global user.email "actions@github.com"
# Add the atomicmemory-internal repository as a secure remote
git remote add private-target "https://${SYNC_USER}:${SYNC_TOKEN}@github.com/atomicstrata/atomicmemory-internal.git"
# Force push the main branch to the private repo to ensure perfect alignment
git push private-target HEAD:main --force