Skip to content

Commit

Permalink
Give workflows names
Browse files Browse the repository at this point in the history
  • Loading branch information
mmwinther committed Feb 22, 2024
1 parent 74eea14 commit 4277a39
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 38 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/generate-java.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Generate Java

on:
push:
branches:
- "**"
- "!main"
- "**"
- "!main"
paths:
- "src/**"
- "generated/java/datadoc-model/pom.xml"
- ".github/workflows/generate-java.yml"
- "src/**"
- "generated/java/datadoc-model/pom.xml"
- ".github/workflows/generate-java.yml"

# Allow only one generate workflow to run at a time. This avoids race conditions when
# pushing to the same branch.
Expand Down Expand Up @@ -38,10 +39,10 @@ jobs:
- name: Generate Java
run: |
pushd generated/java/datadoc-model
rm -rf src/main/java
./mvnw jsonschema2pojo:generate
popd
pushd generated/java/datadoc-model
rm -rf src/main/java
./mvnw jsonschema2pojo:generate
popd
- name: Check for modified files
id: git-check
Expand All @@ -50,11 +51,11 @@ jobs:
- name: Commit
if: steps.git-check.outputs.modified == 'true'
run: |
git add -A
git commit -m '[GENERATE] Java classes from JSON Schema'
git add -A
git commit -m '[GENERATE] Java classes from JSON Schema'
- name: Push
if: steps.git-check.outputs.modified == 'true'
run: |
git pull --rebase origin "${GITHUB_REF}"
git push origin "${GITHUB_REF}"
git pull --rebase origin "${GITHUB_REF}"
git push origin "${GITHUB_REF}"
51 changes: 26 additions & 25 deletions .github/workflows/generate-python.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
name: Generate Python

on:
push:
branches:
- "**"
- "!main"
- "**"
- "!main"
paths:
- "src/**/*.json"
- ".github/workflows/generate-python.yml"
- "src/**/*.json"
- ".github/workflows/generate-python.yml"

# Allow only one generate workflow to run at a time. This avoids race conditions when
# pushing to the same branch.
Expand Down Expand Up @@ -40,29 +41,29 @@ jobs:

- name: Install pipx
run: |
python -m pip install --upgrade pipx
python -m pipx ensurepath
python -m pip install --upgrade pipx
python -m pipx ensurepath
- name: Install datamodel-codegen
run: |
python -m pipx install datamodel-code-generator==0.25.2
python -m pipx install datamodel-code-generator==0.25.2
- name: Generate Python
run: >
datamodel-codegen
--input-file-type jsonschema
--input src/metadata-container-json-schema.json
--output-model-type pydantic_v2.BaseModel
--base-class "datadoc_model.datadoc_base_model.DatadocBaseModel"
--use-default
--use-title-as-name
--use-one-literal-as-default
--force-optional
--use-subclass-enum
--use-standard-collections
--use-double-quotes
--target-python-version 3.10
--output generated/python/datadoc_model/datadoc_model/model.py
datamodel-codegen
--input-file-type jsonschema
--input src/metadata-container-json-schema.json
--output-model-type pydantic_v2.BaseModel
--base-class "datadoc_model.datadoc_base_model.DatadocBaseModel"
--use-default
--use-title-as-name
--use-one-literal-as-default
--force-optional
--use-subclass-enum
--use-standard-collections
--use-double-quotes
--target-python-version 3.10
--output generated/python/datadoc_model/datadoc_model/model.py
- name: Check for modified files
id: git-check
Expand All @@ -71,11 +72,11 @@ jobs:
- name: Commit
if: steps.git-check.outputs.modified == 'true'
run: |
git add -A
git commit -m '[GENERATE] Pydantic models from JSON Schema'
git add -A
git commit -m '[GENERATE] Pydantic models from JSON Schema'
- name: Push
if: steps.git-check.outputs.modified == 'true'
run: |
git pull --rebase origin "${GITHUB_REF}"
git push origin "${GITHUB_REF}"
git pull --rebase origin "${GITHUB_REF}"
git push origin "${GITHUB_REF}"

0 comments on commit 4277a39

Please sign in to comment.