Skip to content
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

DIG-1355: Sonchau/UUID with fk #158

Merged
merged 235 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 231 commits
Commits
Show all changes
235 commits
Select commit Hold shift + click to select a range
bce2b8c
WIP
SonQBChau Oct 25, 2023
b3ff33d
Merge branch 'develop_candig' into sonchau/uuid_with_fk
SonQBChau Oct 26, 2023
1bb0c43
Update apps.py
SonQBChau Oct 27, 2023
be454fb
Update models.py
SonQBChau Oct 27, 2023
d3f2391
Delete pre_signals.py
SonQBChau Oct 27, 2023
a8b7653
Create signals.py
SonQBChau Oct 27, 2023
c3730cc
Update base.txt
SonQBChau Oct 27, 2023
d0010a6
Update models.py
SonQBChau Oct 27, 2023
97b8fec
Update signals.py
SonQBChau Oct 27, 2023
48fb6d0
Update base.txt
SonQBChau Oct 31, 2023
7172d45
Update utils.py
SonQBChau Oct 31, 2023
4d11ffc
Update urls.py
SonQBChau Oct 31, 2023
b03a7d4
Update signals.py
SonQBChau Oct 31, 2023
6a044c3
Create schema.py
SonQBChau Oct 31, 2023
f55b6db
Create new_api.py
SonQBChau Oct 31, 2023
c789bad
Update ingest.py
SonQBChau Oct 31, 2023
5fc7bc2
Update api_ingest.py
SonQBChau Oct 31, 2023
a9afaae
Update api_authorized.py
SonQBChau Oct 31, 2023
1fd5f48
Update schema.py
SonQBChau Nov 2, 2023
fee3c19
Create api.py
SonQBChau Nov 3, 2023
3c334b4
Update api_authorized.py
SonQBChau Nov 3, 2023
512ff6d
Update api_discovery.py
SonQBChau Nov 3, 2023
f1b4dc1
Update api_ingest.py
SonQBChau Nov 3, 2023
c242367
Update authentication.py
SonQBChau Nov 3, 2023
74c2de0
Update README.MD
SonQBChau Nov 3, 2023
faf4fb5
Delete new_api.py
SonQBChau Nov 3, 2023
0c12e82
Update schema.py
SonQBChau Nov 3, 2023
07b5d1e
Update urls.py
SonQBChau Nov 3, 2023
8e0421f
Update utils.py
SonQBChau Nov 3, 2023
85df88f
Update base.py
SonQBChau Nov 3, 2023
8ce9531
Update urls.py
SonQBChau Nov 3, 2023
6258233
Update api_discovery.py
SonQBChau Nov 4, 2023
027d212
Update api.py
SonQBChau Nov 6, 2023
82d02d2
Update api_authorized.py
SonQBChau Nov 6, 2023
dbb7e1e
Update api_discovery.py
SonQBChau Nov 6, 2023
ea50f26
Update urls.py
SonQBChau Nov 6, 2023
7bf1601
Update api.py
SonQBChau Nov 7, 2023
c15638a
Update api_discovery.py
SonQBChau Nov 7, 2023
ed7e6b8
Update permissible_values.py
SonQBChau Nov 7, 2023
16fa193
Update schema.py
SonQBChau Nov 7, 2023
daecd5b
Update utils.py
SonQBChau Nov 7, 2023
d8dda30
Update api.py
SonQBChau Nov 9, 2023
f216334
Update api_authorized.py
SonQBChau Nov 9, 2023
3a0f44a
Update api_discovery.py
SonQBChau Nov 9, 2023
2873cd0
Update api_ingest.py
SonQBChau Nov 9, 2023
554e259
Update permissible_values.py
SonQBChau Nov 9, 2023
a128af1
Update schema.py
SonQBChau Nov 9, 2023
a90a368
Delete locustfile.py
SonQBChau Nov 10, 2023
7ee1f9b
Update api.py
SonQBChau Nov 10, 2023
5f957ae
Update api_authorized.py
SonQBChau Nov 10, 2023
7dd851e
Update api_discovery.py
SonQBChau Nov 10, 2023
f38853b
Update ingest.py
SonQBChau Nov 10, 2023
87e3d86
Update models.py
SonQBChau Nov 10, 2023
46085af
Update schema.py
SonQBChau Nov 10, 2023
42d6aa9
Update api.py
SonQBChau Nov 11, 2023
5556ca5
Update api_authorized.py
SonQBChau Nov 11, 2023
2deb533
Update api_ingest.py
SonQBChau Nov 11, 2023
e353441
Create 0003_alter_exposure_options_alter_donor_unique_together_and_mo…
SonQBChau Nov 11, 2023
e37da13
Update models.py
SonQBChau Nov 11, 2023
8da49e4
Update schema.py
SonQBChau Nov 11, 2023
3bb22e9
Update hooks.py
SonQBChau Nov 11, 2023
341398e
Update api_authorized.py
SonQBChau Nov 13, 2023
84bbc64
Delete api.py
SonQBChau Nov 14, 2023
1d66682
Create api.py
SonQBChau Nov 14, 2023
9215ed5
Create api_authorized.py
SonQBChau Nov 14, 2023
bb1b6f9
Create api_base.py
SonQBChau Nov 14, 2023
0f37be1
Create api_discovery.py
SonQBChau Nov 14, 2023
a41a82e
Create api_ingest.py
SonQBChau Nov 14, 2023
325ec5c
Delete api_authorized.py
SonQBChau Nov 14, 2023
57094b8
Delete api_base.py
SonQBChau Nov 14, 2023
0c204bd
Delete api_discovery.py
SonQBChau Nov 14, 2023
af7f5b6
Delete api_ingest.py
SonQBChau Nov 14, 2023
e8ae5c6
Delete schema.py
SonQBChau Nov 14, 2023
1407b1f
Create discovery_schema.py
SonQBChau Nov 14, 2023
4e178da
Create donor_with_clinical_data_schema.py
SonQBChau Nov 14, 2023
e2c6ebf
Create filter_schema.py
SonQBChau Nov 14, 2023
bcd3d97
Create ingest_schema.py
SonQBChau Nov 14, 2023
f83f04a
Create model_schema.py
SonQBChau Nov 14, 2023
28a0ab4
Create schema.py
SonQBChau Nov 14, 2023
2464a98
Update base.py
SonQBChau Nov 14, 2023
7fbeee9
Update urls.py
SonQBChau Nov 14, 2023
05218df
Update utils.py
SonQBChau Nov 14, 2023
cf6281c
refactor
SonQBChau Nov 14, 2023
8731e77
Update schema.py
SonQBChau Nov 14, 2023
9655237
Update api_authorized.py
SonQBChau Nov 14, 2023
e320a8d
Update pagination.py
SonQBChau Nov 14, 2023
dd463aa
Update api_authorized.py
SonQBChau Nov 16, 2023
5cd9837
Update api_discovery.py
SonQBChau Nov 16, 2023
864e8a3
Create 0004_alter_followup_submitter_primary_diagnosis_id_and_more.py
SonQBChau Nov 16, 2023
3272d41
Update models.py
SonQBChau Nov 16, 2023
42cc9ce
Update pagination.py
SonQBChau Nov 16, 2023
237799d
Update model_schema.py
SonQBChau Nov 16, 2023
025a37d
Update signals.py
SonQBChau Nov 16, 2023
631c4a3
Update test_models.py
SonQBChau Nov 16, 2023
2c59b02
Update model_schema.py
SonQBChau Nov 17, 2023
def7c90
Update test_models.py
SonQBChau Nov 17, 2023
2d0636d
Update model_schema.py
SonQBChau Nov 17, 2023
a760473
Update test_models.py
SonQBChau Nov 17, 2023
ee99b1d
Update test_models.py
SonQBChau Nov 17, 2023
1ded3f1
Update model_schema.py
SonQBChau Nov 17, 2023
dde4815
Update model_schema.py
SonQBChau Nov 17, 2023
e25ddd4
Update test_models.py
SonQBChau Nov 17, 2023
b2e2bf2
Update model_schema.py
SonQBChau Nov 17, 2023
9ea1792
Update test_models.py
SonQBChau Nov 17, 2023
ba67de4
Update test_models.py
SonQBChau Nov 17, 2023
4f08d78
Update test_models.py
SonQBChau Nov 17, 2023
b4c9f63
Update model_schema.py
SonQBChau Nov 17, 2023
799c714
Update test_models.py
SonQBChau Nov 17, 2023
c8db4a6
Update test_models.py
SonQBChau Nov 17, 2023
498e41b
Update local.py
SonQBChau Nov 20, 2023
1970d14
Update test_program.py
SonQBChau Nov 20, 2023
c594930
Update test_donor.py
SonQBChau Nov 20, 2023
426a221
Update factories.py
SonQBChau Nov 20, 2023
764b89a
Update base.py
SonQBChau Nov 20, 2023
9c3e2aa
Update pagination.py
SonQBChau Nov 20, 2023
86546ce
Update api_ingest.py
SonQBChau Nov 20, 2023
320e513
Update api_authorized.py
SonQBChau Nov 20, 2023
53029b9
Update api.py
SonQBChau Nov 20, 2023
c7bcde1
Update api_ingest.py
SonQBChau Nov 21, 2023
28140cf
Update test_primary_diagnoses.py
SonQBChau Nov 21, 2023
70eaada
Update factories.py
SonQBChau Nov 21, 2023
e5ea3cb
Update test_primary_diagnoses.py
SonQBChau Nov 21, 2023
a78b7a9
Update test_sample_registration.py
SonQBChau Nov 21, 2023
d64a39c
Update test_specimen.py
SonQBChau Nov 21, 2023
2b5a3a7
Update test_treatment.py
SonQBChau Nov 21, 2023
ae07138
Update api_authorized.py
SonQBChau Nov 21, 2023
48e92b2
Update test_chemotherapy.py
SonQBChau Nov 21, 2023
764c6c6
Update test_follow_up.py
SonQBChau Nov 21, 2023
d51eb8f
Update test_treatment.py
SonQBChau Nov 21, 2023
ca6b8e3
Update api_discovery.py
SonQBChau Nov 21, 2023
e610c45
Delete api.py
SonQBChau Nov 22, 2023
1e06bb8
Delete api_authorized.py
SonQBChau Nov 22, 2023
29fb1d0
Delete api_base.py
SonQBChau Nov 22, 2023
6923a98
Delete api_discovery.py
SonQBChau Nov 22, 2023
fdc7040
Delete api_ingest.py
SonQBChau Nov 22, 2023
7912470
Create clinical_data.py
SonQBChau Nov 22, 2023
10e406f
Create core.py
SonQBChau Nov 22, 2023
f88dc37
Create discovery.py
SonQBChau Nov 22, 2023
1fb6d79
Create ingestion.py
SonQBChau Nov 22, 2023
f7801fa
Update apps.py
SonQBChau Nov 22, 2023
ba88456
Delete authentication.py
SonQBChau Nov 22, 2023
41fbf00
Update ingest.py
SonQBChau Nov 22, 2023
ecb657d
Update README.MD
SonQBChau Nov 22, 2023
caad75f
Update local.txt
SonQBChau Nov 22, 2023
b22d213
Update dev.txt
SonQBChau Nov 22, 2023
2c6ef74
Update base.txt
SonQBChau Nov 22, 2023
5777742
Update urls.py
SonQBChau Nov 22, 2023
3bdf78e
Update base.py
SonQBChau Nov 22, 2023
41538ac
Delete hooks.py
SonQBChau Nov 22, 2023
d2267c7
Update utils.py
SonQBChau Nov 22, 2023
a0d78df
Delete urls.py
SonQBChau Nov 22, 2023
25c401d
Delete throttling.py
SonQBChau Nov 22, 2023
a38f04f
Update test_models.py
SonQBChau Nov 22, 2023
a88cf70
Update test_chemotherapy.py
SonQBChau Nov 22, 2023
06cb06b
Update base.py
SonQBChau Nov 22, 2023
21bd8fa
Update signals.py
SonQBChau Nov 22, 2023
145d52b
Delete serializers_nested.py
SonQBChau Nov 22, 2023
cc146df
Delete serializers.py
SonQBChau Nov 22, 2023
7aee992
Create nested_data.py
SonQBChau Nov 22, 2023
8cb3499
Create model.py
SonQBChau Nov 22, 2023
0485c18
Create ingestion.py
SonQBChau Nov 22, 2023
e2b810e
Create filter.py
SonQBChau Nov 22, 2023
ed4b04d
Create discovery.py
SonQBChau Nov 22, 2023
00b5154
Delete schema.py
SonQBChau Nov 22, 2023
0b0b89c
Delete model_schema.py
SonQBChau Nov 22, 2023
3dc86c5
Delete ingest_schema.py
SonQBChau Nov 22, 2023
0dc4779
Delete filter_schema.py
SonQBChau Nov 22, 2023
11ea372
Delete donor_with_clinical_data_schema.py
SonQBChau Nov 22, 2023
a56632f
Delete discovery_schema.py
SonQBChau Nov 22, 2023
0b4db88
Delete permissions.py
SonQBChau Nov 22, 2023
6c8af3f
Update permissible_values.py
SonQBChau Nov 22, 2023
fb958d1
Update pagination.py
SonQBChau Nov 22, 2023
0e59ef0
Update models.py
SonQBChau Nov 22, 2023
796e3be
Delete filters.py
SonQBChau Nov 22, 2023
b27cd6d
Update core.py
SonQBChau Nov 22, 2023
0069d6b
Update test_chemotherapy.py
SonQBChau Nov 22, 2023
5627671
Update base.py
SonQBChau Nov 22, 2023
d869fd5
Update core.py
SonQBChau Nov 22, 2023
b3b1949
Update utils.py
SonQBChau Nov 23, 2023
520a8bc
Update ingestion.py
SonQBChau Nov 23, 2023
fc40906
Update ingest.py
SonQBChau Nov 23, 2023
a8bc3f8
Update core.py
SonQBChau Nov 23, 2023
46cd05b
Update clinical_data.py
SonQBChau Nov 23, 2023
d8a7482
Update update-schema.yaml
SonQBChau Nov 23, 2023
6eb7bb1
Create schema.json
SonQBChau Nov 23, 2023
671aad4
Update schema.json
SonQBChau Nov 23, 2023
a289df9
Update model.py
SonQBChau Nov 23, 2023
9413219
Update update-schema.yaml
SonQBChau Nov 23, 2023
78ed4f8
Update clinical_data.py
SonQBChau Nov 23, 2023
5d63a05
Update update-schema.yaml
SonQBChau Nov 23, 2023
a7428a4
make migrations
SonQBChau Nov 23, 2023
013ec9d
Update pagination.py
SonQBChau Nov 23, 2023
1cee60b
Update base.py
SonQBChau Nov 23, 2023
c5b4959
Update factories.py
SonQBChau Nov 23, 2023
e4a605d
fix linter
SonQBChau Nov 23, 2023
0c319da
Update ingestion.py
SonQBChau Nov 23, 2023
7f0b203
Update discovery.py
SonQBChau Nov 23, 2023
0c84314
Update update-schema.yaml
SonQBChau Nov 23, 2023
0d743d1
Update update-schema.yaml
SonQBChau Nov 23, 2023
0a8ff0a
Update ingestion.py
SonQBChau Nov 23, 2023
3f5ab80
Update README.MD
SonQBChau Nov 23, 2023
0df9f31
Update core.py
SonQBChau Nov 23, 2023
e883aca
Update base.py
SonQBChau Nov 23, 2023
a8c1872
Update filter.py
SonQBChau Nov 23, 2023
afa209c
Update core.py
SonQBChau Nov 23, 2023
be97e0c
Merge branch 'develop_candig' into sonchau/uuid_with_fk
SonQBChau Nov 23, 2023
f92c9b0
Update update-schema.yaml
SonQBChau Nov 23, 2023
eedc35c
Update core.py
SonQBChau Nov 23, 2023
cbc874a
Update schema.json
SonQBChau Nov 23, 2023
4b02d7b
Delete schema.yml
SonQBChau Nov 23, 2023
8771a4b
Update schema.json
github-actions[bot] Nov 23, 2023
60f7da4
get donor with clinical data with full path
SonQBChau Nov 24, 2023
481378e
rename ingest script
SonQBChau Nov 24, 2023
1107bbb
Update schema.json
github-actions[bot] Nov 24, 2023
9999e5f
Update openapi.md
github-actions[bot] Nov 24, 2023
bfdaf24
fix logging
SonQBChau Nov 24, 2023
5d3443e
clarify log
SonQBChau Nov 24, 2023
f149f45
separate prod and dev settings
SonQBChau Nov 27, 2023
ed4b2fa
fix tqdm in prod env
SonQBChau Nov 28, 2023
27f9d91
fix data_loader install permission
SonQBChau Nov 28, 2023
4f310ed
fix sampleregistration typo
SonQBChau Nov 29, 2023
241754b
fix typo in schema donor with clinical
SonQBChau Nov 29, 2023
7e600ba
Update schema.json
github-actions[bot] Nov 30, 2023
81cdecf
Update schema.yml
github-actions[bot] Nov 30, 2023
3d554fb
Update schema.md
github-actions[bot] Nov 30, 2023
1847181
Update schema.json
github-actions[bot] Nov 30, 2023
626c499
Update schema.json
github-actions[bot] Nov 30, 2023
6e40abb
Update schema.yml
github-actions[bot] Nov 30, 2023
c2fe2b3
Update schema.md
github-actions[bot] Nov 30, 2023
bc28477
Update schema.yml
github-actions[bot] Nov 30, 2023
6675eac
Update schema.md
github-actions[bot] Nov 30, 2023
4e635fd
remove default value (makes fields optional)
daisieh Dec 2, 2023
ba1ad14
Update schema.json
github-actions[bot] Dec 2, 2023
f2974ee
Update schema.yml
github-actions[bot] Dec 2, 2023
9ab3f17
Update schema.md
github-actions[bot] Dec 2, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/commitFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
async function getFileSha(fileName, github_ref, octokit, context) {
const path = "chord_metadata_service/mohpackets/docs/" + fileName;
const { data } = await octokit.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path,
ref: github_ref,
});
return data.sha;
}

async function commitAndPushChanges(
fileName,
github_ref,
fs,
octokit,
context
) {
const repoPath = "chord_metadata_service/mohpackets/docs/";
const fileSha = await getFileSha(fileName, github_ref, octokit, context);

// Read the content of the updated file
const fileContent = fs.readFileSync(`./${repoPath}${fileName}`, "utf8");

// Commit and push changes
await octokit.request(
`PUT /repos/{owner}/{repo}/contents/${repoPath}{fileName}`,
{
owner: context.repo.owner,
repo: context.repo.repo,
fileName,
message: `Update ${fileName}`,
content: Buffer.from(fileContent).toString("base64"),
sha: fileSha,
branch: github_ref,
}
);
}

module.exports = {
commitAndPushChanges,
};
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
name: Set up Python
with:
python-version: '3.10'
python-version: '3.12'
- name: Install flake8
run: python -m pip install flake8
- name: Run linter
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ jobs:
# If you want to test multiple python version(s)
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.10', '3.11', '3.12']
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
Expand Down
120 changes: 45 additions & 75 deletions .github/workflows/update-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,44 @@ name: Docs
on:
pull_request:
types: [review_requested, ready_for_review]


jobs:
generate-moh-schema:
name: Update MoH schema
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.12"

- name: Install dependencies
run: python -m pip install -r requirements/dev.txt
run: python -m pip install -r requirements/base.txt

- 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: Update schema.json with new SHA
run: |
REPO_OWNER=${{ github.repository_owner }}
REPO_NAME=${{ github.repository }}
HEAD_REF=${{ github.head_ref }}
SHA=$(git rev-parse HEAD)

SCHEMA_PATH=chord_metadata_service/mohpackets/docs/schema.json

sed -i 's|"description": "This is the RESTful API for the MoH Service."|"description": "This is the RESTful API for the MoH Service. Based on https://raw.githubusercontent.com/'"$REPO_NAME"'/'"$SHA"'/'"$SCHEMA_PATH"'"|' $SCHEMA_PATH

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18

Expand All @@ -34,88 +51,41 @@ jobs:
- name: Install npm
run: npm install

- name: Install widdershins
run: npm install -g widdershins

- name: Generate new schema.yml
run: python manage.py spectacular --file ./chord_metadata_service/mohpackets/docs/schema.yml --validate --fail-on-warn

- name: Convert schema to OpenAPI documentation
run: |
npx widdershins ./chord_metadata_service/mohpackets/docs/schema.yml -o ./chord_metadata_service/mohpackets/docs/openapi.md -u ./chord_metadata_service/mohpackets/docs/widdershins/templates/openapi3 -c true --omitHeader true

- name: Install octokit/rest
run: npm install @octokit/rest

- name: Update schema.yml and openapi.md
- 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);

// get SHA from each file
const repoPath = 'chord_metadata_service/mohpackets/docs/';
const getFileSha = async (path) => {
const { data } = await octokit.repos.getContent({
owner: context.repo.owner,
repo: context.repo.repo,
path: `${repoPath}${path}`,
ref: `${{ github.head_ref }}`
});
return data.sha;
}

// get last commit sha for repo
const getRepoSha = async () => {
const { data } = await octokit.rest.repos.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `${{ github.head_ref }}`
});
return data.sha;
}

const schemaSha = await getFileSha('schema.yml');
const openApiSha = await getFileSha('openapi.md');
const repoSha = await getRepoSha();

// Read the content of updated files
let schemaYml = fs.readFileSync(`./${repoPath}schema.yml`, 'utf8');
const openApiMd = fs.readFileSync(`./${repoPath}openapi.md`, 'utf8');

// Update description to include sha of
let schemaLines = schemaYml.split('\n');
for (let i = 0; i < schemaLines.length; ++i) {
if ("description: This is the RESTful API for the MoH Service." === schemaLines[i].trim()) {
schemaLines[i] += ' Based on https://raw.githubusercontent.com/' + context.repo.owner + '/' + context.repo.repo + '/' + repoSha + '/' + repoPath + 'schema.yml';
}
}
schemaYml = schemaLines.join('\n');
fs.writeFileSync(`./${repoPath}schema.yml`, schemaYml, 'utf8');

// Commit and push changes
await octokit.request(`PUT /repos/{owner}/{repo}/contents/${repoPath}{path}`, {
owner: context.repo.owner,
repo: context.repo.repo,
path: 'schema.yml',
message: 'Update schema.yml',
content: Buffer.from(schemaYml).toString('base64'),
sha: schemaSha,
branch: `${{ github.head_ref }}`
});

await octokit.request(`PUT /repos/{owner}/{repo}/contents/${repoPath}{path}`, {
owner: context.repo.owner,
repo: context.repo.repo,
path: 'openapi.md',
message: 'Update openapi.md',
content: Buffer.from(openApiMd).toString('base64'),
sha: openApiSha,
branch: `${{ github.head_ref }}`
});
- name: Install widdershins
run: npm install -g widdershins

- name: Convert schema to OpenAPI documentation
run: |
npx widdershins ./chord_metadata_service/mohpackets/docs/schema.json -o ./chord_metadata_service/mohpackets/docs/schema.md -u ./chord_metadata_service/mohpackets/docs/widdershins/templates/openapi3 -c true --omitHeader true

- name: Install PyYAML
run: pip install PyYAML

- name: Convert schema.json to schema.yml
run: python -c 'import json, yaml; json.load(open("chord_metadata_service/mohpackets/docs/schema.json")); print(yaml.dump(json.load(open("chord_metadata_service/mohpackets/docs/schema.json"))))' > chord_metadata_service/mohpackets/docs/schema.yml

- name: Commit and push changes to schema.yml and schema.md
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.yml', `${{ github.head_ref }}`, fs, octokit, context);
await commitAndPushChanges('schema.md', `${{ github.head_ref }}`, fs, octokit, context);
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ py -3 -m venv .venv
With your virtual environment activated, navigate to the project directory and install the project dependencies:

```bash
pip install -r requirements/dev.txt
pip install -r requirements/local.txt
```

This will install all the packages needed for development.
Expand Down
Loading