Skip to content

Generate SDK

Generate SDK #761

name: Generate SDK
on:
schedule:
- cron: '30 5 * * *'
workflow_dispatch:
jobs:
generate-client:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- run: make install-goimports
- name: Fetch changes
working-directory: ./tools
run: make fetch_openapi
- name: Commit OpenAPI changes
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add .
git commit --allow-empty -m "fix: update OpenAPI spec"
- name: Run generation
working-directory: ./tools
run: |
export PATH=${PATH}:`go env GOPATH`/bin
make clean_and_generate
- name: Verify Changed files
uses: tj-actions/verify-changed-files@530d86d0a237225c87beaa000750988f8965ee31
id: verify-changed-files
with:
files: |
./admin/**/*
- name: Run docs generation
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: make gen-docs
- name: Commit Generator Changes
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
git add . && git commit -m "fix: Generated SDK source code and docs"
- name: Release updates
if: steps.verify-changed-files.outputs.files_changed == 'true'
working-directory: ./tools
run: make new-version
- name: Ensure all markdown code is formatted
if: steps.verify-changed-files.outputs.files_changed == 'true'
working-directory: ./tools
run: |
npm install && npm run format
- name: Run mock generation
working-directory: ./tools
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: make generate_mocks
- uses: peter-evans/create-pull-request@v7
if: steps.verify-changed-files.outputs.files_changed == 'true'
with:
token: ${{ secrets.APIX_BOT_PAT }}
title: "APIBot: SDK update based on recent changes in Atlas API"
commit-message: "fix: required version bumps for Atlas SDK release"
delete-branch: true
branch: api-bot-update
body: |
Automatic update for MongoDB Atlas Go Client based on OpenAPI changes.
PR contains autogenerated changes for the MongoDB Atlas client.
## Automated checks
1. Compilation and unit tests
2. Documentation style
3. Transformation engine linting
## Important Details
1. If the build is failing please check the logs and fix the issues in the OpenAPI file (openapi/atlas-api.yaml)
2. Do not attempt to manually fix any issues in the Golang code as all changes are automatically generated.
Fixes should be applied to the OpenAPI file (openapi/atlas-api.yaml) or ./tools engine in a separate PR.
## Manual Review Procedure
1. Review changes in the OpenAPI file (openapi/atlas-api.yaml)
2. If PR contains breaking changes, review `./releaser/breaking_changes/{release_version}.md` file
3. Approve and merge PR into the main branch
4. After the merge automated release process will be triggered.
## Troubleshooting
To skip release process after merge please revert changes from `version.go` file.
Release can be triggered by restoring changes in version.go.