-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created (very) rough draft for autogenerating bindings on schema chan…
…ges.
- Loading branch information
1 parent
4f4655a
commit 9026c5f
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Update JSONSchema and Golang schema bindings | ||
Check notice Code scanning / Checkov (reported by Codacy) Ensure top-level permissions are not set to write-all Note
Ensure top-level permissions are not set to write-all
|
||
|
||
on: | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
changed_files: | ||
runs-on: ubuntu-latest | ||
name: Determine schema changes | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get metadata schema changes | ||
id: metadata-schema-changes | ||
uses: tj-actions/changed-files@v44 | ||
with: | ||
files: | | ||
schema/kbase/linkml/credit_metadata.yaml | ||
- name: Set up python | ||
if: steps.changed-markdown-files.outputs.any_changed == 'true' | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Regenerate JSONSchema bindings for credit metadata schame | ||
if: steps.changed-markdown-files.outputs.any_changed == 'true' | ||
shell: bash -l {0} | ||
run: | | ||
pip3 install linkml # and any other bits and pieces required - I think that's it, though | ||
gen-json-schema schema/kbase/linkml/credit_metadata.yaml > schema/kbase/jsonschema/credit_metadata.schema.json | ||
- name: Commit regenerated JSONSchema bindings | ||
if: steps.changed-markdown-files.outputs.any_changed == 'true' | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Regenerated JSONSchema bindings for credit metadata schema | ||
|
||
- name: checkout DTS repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kbase/dts | ||
path: dts | ||
|
||
- name: Regenerate DTS Golang bindings for credit metadata schame | ||
if: steps.changed-markdown-files.outputs.any_changed == 'true' | ||
shell: bash -l {0} | ||
run: | | ||
gen-golang schema/kbase/linkml/credit_metadata.yaml > dts/credit/metadata.go | ||
- name: Create DTS pull request with regenerated credit metadata bindings | ||
if: steps.changed-markdown-files.outputs.any_changed == 'true' | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.PAT }} # https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens |