Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ runs:
python-version: ${{ inputs.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 #v8.2.0
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
- name: Install dependencies
shell: bash
env:
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/api-doc.yml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pp: I think we can stack #64 on top of this PR too, since it affects similar files.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: api-doc

on:
push:
tags:
- 'gen-v*'
- 'base-v*'
- 'core-v*'
workflow_dispatch: ~

jobs:
doc:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.SAP_AI_SDK_BOT_CLIENT_ID }}
private-key: ${{ secrets.SAP_AI_SDK_BOT_PRIVATE_KEY }}
repositories: |
ai-sdk-python
ai-sdk
permission-contents: write
permission-pull-requests: write

- name: Setup
uses: SAP/ai-sdk-python/.github/actions/setup@main

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: Is it intended that we don't pin this branch to a SHA?

with:
token: ${{ steps.app-token.outputs.token }}
ref: ${{ github.ref }}
index-username: ${{ secrets.ARTIFACTORY_USERNAME }}
index-token: ${{ secrets.ARTIFACTORY_TOKEN }}

- name: Generate docs
run: uv run make docs

- name: Checkout sap/ai-sdk
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
repository: SAP/ai-sdk
token: ${{ steps.app-token.outputs.token }}
path: ai-sdk
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
persist-credentials: false

- name: Configure git
env:
BOT_EMAIL: ${{ vars.SAP_AI_SDK_BOT_EMAIL }}
BOT_NAME: ${{ vars.SAP_AI_SDK_BOT_NAME }}
run: |
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
env:
TAG: ${{ github.ref_name }}
run: |
BRANCH="api-docs-python-$TAG-$(date +%Y%m%d)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: I wanted to ask whether it could be a problem that we generate multiple api docs per day. Maybe, it makes sense to add a 5-6 char long salt at the end to randomize it?

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
echo "No documentation changes to commit"
echo "changed=false" >> "$GITHUB_OUTPUT"
else
git commit -m "chore: update Python API docs ($TAG)"
git push origin "$BRANCH"
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Create pull request
if: steps.update-docs.outputs.changed == 'true'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
TAG: ${{ github.ref_name }}
TAG_URL: ${{ github.server_url }}/${{ github.repository }}/releases/tag/${{ github.ref_name }}
BRANCH: ${{ steps.update-docs.outputs.branch }}
run: |
gh pr create \
--repo SAP/ai-sdk \
--base main \
--head "$BRANCH" \
--title "chore: update Python API docs ($TAG)" \
--body "Automated update of Python API docs from [$TAG]($TAG_URL) in SAP/ai-sdk-python."
64 changes: 0 additions & 64 deletions .github/workflows/auto-doc.yml

This file was deleted.

131 changes: 0 additions & 131 deletions packages/base/docs/ai_api_client_sdk.ai_api_v2_client.html

This file was deleted.

Loading
Loading