Files
altstack-data/.github/workflows/sync-to-main-app.yml
2026-04-11 22:21:49 +05:30

67 lines
2.4 KiB
YAML

name: '🔄 Sentinel: Sync to thealtstack'
on:
push:
branches:
- main
paths:
- 'data/**'
- 'docker-deploy/**'
workflow_dispatch: {}
jobs:
sync:
if: "!contains(github.event.head_commit.message, 'Sentinel: Synchronization from')"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: 📥 Checkout altstack-data (source)
uses: actions/checkout@v4
with:
path: source-repo
- name: 📥 Manual Checkout thealtstack (target)
run: |
echo "🔍 Sentinel: Running Auth Health Check..."
if [ -z "${{ secrets.GH_PAT }}" ]; then
echo "❌ ERROR: GH_PAT secret is missing in this repository!"
exit 1
fi
# Try to clone with error trapping
if ! git clone https://x-access-token:${{ secrets.GH_PAT }}@github.com/aa-humaaan/thealtstack.git target-repo; then
echo "--------------------------------------------------------------------------------"
echo "❌ CRITICAL: AUTHENTICATION FAILURE (403/401)"
echo "Aditya, the 'GH_PAT' secret in this repository is invalid or lacks permissions."
echo "FIX: Refresh your Personal Access Token with 'repo' scope and update it in:"
echo "https://github.com/altstackHQ/altstack-data/settings/secrets/actions"
echo "--------------------------------------------------------------------------------"
exit 1
fi
cd target-repo
git checkout main
- name: 🔄 Copy data and docker-deploy
run: |
mkdir -p target-repo/data target-repo/docker-deploy
rsync -av --delete source-repo/data/ target-repo/data/
rsync -av --delete source-repo/docker-deploy/ target-repo/docker-deploy/
- name: '📤 Sentinel: Push updates to thealtstack'
run: |
cd target-repo
git config user.name "Sovereign Sentinel (AI)"
git config user.email "sentinel@thealtstack.com"
git add data/ docker-deploy/
if git diff --staged --quiet; then
echo "💤 Sentinel: Dataset remains optimal. No sync required."
exit 0
fi
git commit -m "🤖 Sentinel: Synchronization from altstackHQ/altstack-data"
git push origin main