Skip to content

Merge pull request #1419 from maximhq/01-22-updated_openapi_spec #75

Merge pull request #1419 from maximhq/01-22-updated_openapi_spec

Merge pull request #1419 from maximhq/01-22-updated_openapi_spec #75

name: OpenAPI Bundle
on:
push:
branches: ["main"]
paths:
- ".github/workflows/openapi-bundle.yml"
- "docs/openapi/**"
- "!docs/openapi/openapi.json"
pull_request:
paths:
- "docs/openapi/**"
- "!docs/openapi/openapi.json"
permissions:
contents: write
jobs:
bundle-openapi:
name: Bundle OpenAPI Spec
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Install dependencies
run: pip install pyyaml
- name: Bundle OpenAPI spec
working-directory: ./docs/openapi
run: python bundle.py
- name: Commit and push changes
run: |
CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
if [ "$CURRENT_BRANCH" = "HEAD" ]; then
# In detached HEAD state (common in CI), use GITHUB_REF_NAME or default to main
CURRENT_BRANCH="${GITHUB_REF_NAME:-main}"
fi
git add docs/openapi/openapi.json
git commit -m "chore: regenerate openapi.json --skip-pipeline"
git push origin "$CURRENT_BRANCH"