From e57dbb8da728c27d6e180bd9009452ef6fd10c0c Mon Sep 17 00:00:00 2001 From: Anso Date: Tue, 26 May 2026 16:36:11 -0400 Subject: [PATCH] chore(docs): restore docs mirror sync (#1237) Add a dedicated workflow that mirrors docs/ to the sencho-docs repository on docs changes to main. The workflow also supports manual dispatch for backfilling stale docs deployments. --- .github/workflows/docs-sync.yml | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/docs-sync.yml diff --git a/.github/workflows/docs-sync.yml b/.github/workflows/docs-sync.yml new file mode 100644 index 00000000..f86a801e --- /dev/null +++ b/.github/workflows/docs-sync.yml @@ -0,0 +1,65 @@ +name: Sync Docs + +on: + push: + branches: + - main + paths: + - docs/** + - .github/workflows/docs-sync.yml + workflow_dispatch: + +concurrency: + group: docs-sync-main + cancel-in-progress: true + +permissions: + contents: read + +jobs: + sync-docs: + name: Sync docs to sencho-docs + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + # Mint an installation token scoped to the mirror repository only. The + # default GITHUB_TOKEN cannot push to Studio-Saelix/sencho-docs. + - name: Generate GitHub App installation token + id: app-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + app-id: ${{ secrets.APP_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + owner: ${{ github.repository_owner }} + repositories: sencho-docs + permission-contents: write + + - name: Checkout Sencho repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + path: sencho + + - name: Checkout sencho-docs repo + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + repository: ${{ github.repository_owner }}/sencho-docs + token: ${{ steps.app-token.outputs.token }} + path: sencho-docs + + - name: Copy /docs into sencho-docs root + run: rsync -av --delete --exclude='.git' sencho/docs/ sencho-docs/ + + - name: Commit and push to sencho-docs + working-directory: sencho-docs + run: | + git config user.email "docs-bot@sencho.io" + git config user.name "Sencho Docs Bot" + git add -A + + if git diff --cached --quiet; then + echo "No docs changes to sync." + exit 0 + fi + + git commit -m "docs: sync from main@${{ github.sha }}" + git push origin HEAD:main