feat: add GH workflow to generate openapi schema - #39025
Conversation
Add GH workflow to automatically generate openapi schema whenever view file tagged with the "openedx-platform-sdk" @extend_schema tag changes
b5c8f71 to
69a3dd8
Compare
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| pip install --upgrade pip |
There was a problem hiding this comment.
We're using uv in this repo now, see how we do this in other workflows and sync it up.
| --file cms_schema.yml | ||
|
|
||
| - name: Open pull request if schemas changed | ||
| uses: peter-evans/create-pull-request@v6 |
There was a problem hiding this comment.
This PR should tag the current on-call engineer via the @openedx/wg-maintenance-openedx-platform-oncall team.
| # Switch to a lighter settings module if production settings require | ||
| # environment variables or external services that are unavailable in CI. | ||
| python manage.py spectacular \ | ||
| --settings=lms.envs.production \ |
There was a problem hiding this comment.
Is there a reason this can't use the default settings file? Today it's the devstack settings file.
|
|
||
| **Do not edit these files by hand** — they will be overwritten on the next run. | ||
|
|
||
| @openedx/wg-maintenance-openedx-platform-oncall heads up on this automated PR. |
There was a problem hiding this comment.
Use team-reviewers parameter instead: https://github.com/peter-evans/create-pull-request
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| # Triggers whenever a view file tagged with the openedx-platform-sdk | ||
| # @extend_schema tag changes — add new tagged view paths here as more | ||
| # APIs are onboarded to the SDK. | ||
| # | ||
| # LMS — Enrollment v2 | ||
| - 'openedx/core/djangoapps/enrollments/**' | ||
| # CMS — XBlock v1, Home v3/v4, Course Details v3, Authoring Grading v3 | ||
| - 'cms/djangoapps/contentstore/rest_api/v1/views/xblock.py' | ||
| - 'cms/djangoapps/contentstore/rest_api/v3/views/home.py' | ||
| - 'cms/djangoapps/contentstore/rest_api/v3/views/course_details.py' | ||
| - 'cms/djangoapps/contentstore/rest_api/v3/views/authoring_grading.py' | ||
| - 'cms/djangoapps/contentstore/rest_api/v4/views/home.py' | ||
| # drf-spectacular config changes in either service | ||
| - 'lms/lib/spectacular.py' | ||
| - 'cms/lib/spectacular.py' | ||
| - 'lms/envs/common.py' | ||
| - 'cms/envs/common.py' |
There was a problem hiding this comment.
Rather than running this on every change to these files, what about running this once weekly on any changes. That way we don't need to maintain a list of files here, any changes to any of our tagged schemas will get picked up.
Add GH workflow to automatically generate openapi schema whenever view file tagged with the "openedx-platform-sdk" @extend_schema tag changes.
Related PR: edly-io/openedx-platform-sdk#1