From 391f7edbd2bb0f1dfb58e49b2bdec1f1a83bd3a7 Mon Sep 17 00:00:00 2001 From: Marika Marszalkowski Date: Tue, 18 Aug 2026 09:10:00 +0200 Subject: [PATCH 1/2] improve workflow --- .github/workflows/api-doc.yml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/api-doc.yml b/.github/workflows/api-doc.yml index 45daba3..4cb6e68 100644 --- a/.github/workflows/api-doc.yml +++ b/.github/workflows/api-doc.yml @@ -41,7 +41,7 @@ jobs: repository: SAP/ai-sdk token: ${{ steps.app-token.outputs.token }} path: ai-sdk - persist-credentials: false + persist-credentials: true - name: Configure git env: @@ -51,33 +51,39 @@ jobs: git -C ai-sdk config user.email "$BOT_EMAIL" git -C ai-sdk config user.name "$BOT_NAME" - - name: Update api docs - id: update-docs + - name: Prepare docs branch + id: prepare-docs env: REF: ${{ github.ref_name }} run: | BRANCH="api-docs-python-$REF" echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" - cd ai-sdk - git checkout -b "$BRANCH" - rm -rf static/api-python - cp -r ../api-docs/ static/api-python - git add static/api-python - if git diff --cached --quiet; then + git -C ai-sdk checkout -b "$BRANCH" + rm -rf ai-sdk/static/api-python + cp -r api-docs/ ai-sdk/static/api-python + git -C ai-sdk add static/api-python + if git -C ai-sdk diff --cached --quiet; then echo "No documentation changes to commit" echo "changed=false" >> "$GITHUB_OUTPUT" else - git commit -m "chore: update Python API docs ($REF)" - git push --force origin "$BRANCH" echo "changed=true" >> "$GITHUB_OUTPUT" fi + - name: Push docs branch + if: steps.prepare-docs.outputs.changed == 'true' + env: + REF: ${{ github.ref_name }} + BRANCH: ${{ steps.prepare-docs.outputs.branch }} + run: | + git -C ai-sdk commit -m "chore: update Python API docs ($REF)" + git -C ai-sdk push --force origin "$BRANCH" + - name: Create pull request - if: steps.update-docs.outputs.changed == 'true' + if: steps.prepare-docs.outputs.changed == 'true' env: GH_TOKEN: ${{ steps.app-token.outputs.token }} REF: ${{ github.ref_name }} - BRANCH: ${{ steps.update-docs.outputs.branch }} + BRANCH: ${{ steps.prepare-docs.outputs.branch }} run: | if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then REF_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/tree/$REF" From 97afe6ddf92d63f168a4541c00cff1a4de0bd10d Mon Sep 17 00:00:00 2001 From: Marika Marszalkowski Date: Tue, 18 Aug 2026 11:08:46 +0200 Subject: [PATCH 2/2] Apply suggestion from @marikaner --- .github/workflows/api-doc.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/api-doc.yml b/.github/workflows/api-doc.yml index 4cb6e68..cc4b955 100644 --- a/.github/workflows/api-doc.yml +++ b/.github/workflows/api-doc.yml @@ -32,6 +32,7 @@ jobs: with: token: ${{ steps.app-token.outputs.token }} ref: ${{ github.ref }} + - name: Generate docs run: uv run make docs