From 29b40abfcf224db504fd5d6931b5d7c195492d2b Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 4 Sep 2026 12:19:47 -0400 Subject: [PATCH] ci(docs-sync): forward-port the tutorials into cosmos/docs latest/ The example tutorials tell the reader to clone this repo and check out main, so they document whatever main is now rather than a released version. A frozen copy in cosmos/docs latest/ therefore describes code the reader is not running. Nothing carried the sync into latest/, and it sat two syncs behind for months. The script and the reasoning live in cosmos/docs; only the call is here. The step skips itself when the script is absent, so this works whether it merges before or after the cosmos/docs side. Co-Authored-By: Claude Opus 5 --- .github/workflows/docs-sync.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/docs-sync.yml b/.github/workflows/docs-sync.yml index d91d2b3..7280d52 100644 --- a/.github/workflows/docs-sync.yml +++ b/.github/workflows/docs-sync.yml @@ -36,6 +36,11 @@ jobs: - name: Checkout example repo uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Set up Python uses: actions/setup-python@v5 with: @@ -92,6 +97,25 @@ jobs: --input docs/ \ --output-dir cosmos-docs/sdk/next/tutorials/example/ + # The example tutorials are the one exception to cosmos/docs' version + # freeze. They tell the reader to `git clone` this repo and + # `git checkout main`, so they document whatever main is now rather than a + # released version, and a frozen latest/ copy just describes code the + # reader is not running. Before this step existed, latest/ sat two syncs + # behind for months. + # + # The script and the reasoning live in cosmos/docs, so only the call is + # here. Skipped if it is absent, which keeps this workflow working whether + # it merges before or after the cosmos/docs side. + - name: Forward-port the tutorials into latest/ + run: | + cd cosmos-docs + if [ ! -f scripts/sync-next-to-latest.js ]; then + echo "::warning::scripts/sync-next-to-latest.js is not on cosmos/docs main yet, skipping the forward-port. latest/ will lag until it lands." + exit 0 + fi + node scripts/sync-next-to-latest.js sdk/next/tutorials/example/ + - name: Commit, then open or update the PR on cosmos/docs env: GH_TOKEN: ${{ secrets.DOCS_REPO_TOKEN }} @@ -105,6 +129,7 @@ jobs: git remote set-url origin "https://x-access-token:${{ secrets.DOCS_REPO_TOKEN }}@github.com/cosmos/docs.git" git add sdk/next/tutorials/example/ + git add sdk/latest/tutorials/example/ if git diff --cached --quiet; then echo "No doc changes to sync, nothing to commit."