Merge pull request #67 from AnsoCode/fix/ci-docs-jobs

fix(ci): fix sync-docs empty-repo crash and update-screenshots protected-branch push
This commit is contained in:
Anso
2026-03-23 00:15:11 -04:00
committed by GitHub
2 changed files with 27 additions and 8 deletions
+23 -8
View File
@@ -223,13 +223,16 @@ jobs:
E2E_USERNAME: admin
E2E_PASSWORD: password123
- name: Commit updated screenshots
run: |
git config user.email "docs-bot@sencho.io"
git config user.name "Sencho Docs Bot"
git add docs/images/
git commit -m "docs: refresh screenshots" || echo "No changes to commit"
git push
- name: Open / update screenshots PR
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: chore/refresh-screenshots
commit-message: "docs: refresh screenshots"
title: "docs: refresh screenshots"
body: "Automated screenshot refresh — generated by the `update-screenshots` CI job on every push to `develop`."
add-paths: docs/images/
delete-branch: true
sync-docs:
runs-on: ubuntu-latest
@@ -246,6 +249,18 @@ jobs:
repository: AnsoCode/sencho-docs
token: ${{ secrets.DOCS_REPO_TOKEN }}
path: sencho-docs
# An empty repo (no commits yet) will fail the checkout — handled below
continue-on-error: true
- name: Initialize sencho-docs if repo is empty
run: |
if [ ! -d "sencho-docs/.git" ]; then
echo "sencho-docs has no .git — initializing fresh repo"
mkdir -p sencho-docs
cd sencho-docs
git init -b main
git remote add origin "https://x-access-token:${{ secrets.DOCS_REPO_TOKEN }}@github.com/AnsoCode/sencho-docs.git"
fi
- name: Copy /docs into sencho-docs root
run: rsync -av --delete sencho/docs/ sencho-docs/
@@ -258,4 +273,4 @@ jobs:
git config user.name "Sencho Docs Bot"
git add -A
git commit -m "docs: sync from develop@${{ github.sha }}" || echo "No changes to commit"
git push
git push origin HEAD:main
+4
View File
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- fix(ci): `update-screenshots` was pushing directly to the protected `develop` branch; replaced the `git push` step with `peter-evans/create-pull-request@v6` which opens/updates a `chore/refresh-screenshots` PR instead
- fix(ci): `sync-docs` failed with `fatal: not in a git directory` when `sencho-docs` is empty (no commits); added `continue-on-error: true` on the checkout step plus a fallback `git init -b main` with remote re-add, then pushes with `git push origin HEAD:main` to create the branch on first run
### Added
- feat: automated documentation pipeline with Mintlify sync
- feat: CI job to auto-refresh doc screenshots on every develop push