Skip to content

Update nested_data.py #38

Update nested_data.py

Update nested_data.py #38

name: Docs
on:
pull_request:
types: [review_requested, ready_for_review]
jobs:
first_job:
name: Update MoH schema
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v4
with:
submodules: true
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: python -m pip install -r requirements/base.txt
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Create package.json file
run: |
echo '{"name": "my-project", "version": "1.0.0"}' > package.json
- name: Install npm
run: npm install
- name: Install octokit/rest
run: npm install @octokit/rest
- name: Generate new schema.json
run: |
export DJANGO_SETTINGS_MODULE=config.settings.base
python manage.py export_openapi_schema --api chord_metadata_service.mohpackets.apis.core.api | python -m json.tool > chord_metadata_service/mohpackets/docs/schema.json
- name: Commit and push changes to schema.json
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const { Octokit } = require('@octokit/rest');
const octokit = new Octokit({ request: { fetch: fetch, }, auth: "${{ secrets.GITHUB_TOKEN }}" });
const { commitAndPushChanges } = require("./.github/commitFile.js");
await commitAndPushChanges('schema.json', `${{ github.head_ref }}`, fs, octokit, context);