-
Notifications
You must be signed in to change notification settings - Fork 2
chore: Add job to generate api docs #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3ca359c
replace job
marikaner bda22d8
delete files
marikaner 13c795d
pin versions
marikaner 57505d7
fix zizmor findings
marikaner b05c429
add time
marikaner 42f155c
improve tag handling
marikaner 1e5abc8
use ref directly
marikaner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| 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 | ||
|
marikaner marked this conversation as resolved.
|
||
| with: | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| ref: ${{ github.ref }} | ||
| - 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 | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
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: | ||
| 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 | ||
| 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: Create pull request | ||
| if: steps.update-docs.outputs.changed == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| REF: ${{ github.ref_name }} | ||
| BRANCH: ${{ steps.update-docs.outputs.branch }} | ||
| run: | | ||
| if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then | ||
| REF_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/tree/$REF" | ||
| else | ||
| REF_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$REF" | ||
| fi | ||
| if gh pr list --repo SAP/ai-sdk --head "$BRANCH" --json number --jq '.[0].number' | grep -q .; then | ||
| echo "Pull request already exists for branch $BRANCH" | ||
| else | ||
| gh pr create \ | ||
| --repo SAP/ai-sdk \ | ||
| --base main \ | ||
| --head "$BRANCH" \ | ||
| --title "chore: update Python API docs ($REF)" \ | ||
| --body "Automated update of Python API docs from [$REF]($REF_URL) in SAP/ai-sdk-python." | ||
| fi | ||
This file was deleted.
Oops, something went wrong.
131 changes: 0 additions & 131 deletions
131
packages/base/docs/ai_api_client_sdk.ai_api_v2_client.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.