Skip to content

Commit 192eb2e

Browse files
authored
Merge pull request #115 from puja-trivedi/add_input_to_wf
Add input to wf
2 parents 67da881 + 27ae7aa commit 192eb2e

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

.github/workflows/generate_yaml_model.yaml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# Generates linkml yaml schema from metadata in googlesheets using schemasheets
22
name: generating yaml file
33

4-
on: workflow_dispatch
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
model:
8+
description: 'model name'
9+
required: true
10+
type: string
511

612
jobs:
713
generate_libgen_yaml:
@@ -26,11 +32,27 @@ jobs:
2632
sudo apt-get update
2733
sudo apt-get install -y build-essential git wget curl
2834
35+
# Check if download-dir exists; if not, create it
36+
- name: Check if download-dir exists
37+
run: |
38+
if [ ! -d "linkml-schema/source_${{ inputs.model }}/gsheet_output" ]; then
39+
echo "Directory does not exist. Making directory"
40+
mkdir -p linkml-schema/source_${{ inputs.model }}/gsheet_output
41+
fi
42+
43+
# Check if gsheet.yaml exists
44+
- name: Check if gsheet.yaml exists
45+
run: |
46+
if [ ! -f "linkml-schema/source_${{ inputs.model }}/gsheet.yaml" ]; then
47+
echo "gsheet.yaml does not exist. Exiting"
48+
exit 1
49+
fi
50+
2951
# Generate yaml model
3052
- name: Generate yaml model
3153
run: |
3254
cd linkml-schema
33-
bkbit schema2model -o library_generation.yaml --gsheet --gsheet-download-dir source_library_generation/gsheet_output source_library_generation/gsheet.yaml --no-inlined
55+
bkbit schema2model -o ${{ inputs.model }}.yaml --gsheet --gsheet-download-dir source_${{ inputs.model }}/gsheet_output source_${{ inputs.model }}/gsheet.yaml --no-inlined
3456
cd ..
3557
3658
# Generate unique branch name
@@ -45,8 +67,8 @@ jobs:
4567
uses: peter-evans/create-pull-request@v4
4668
with:
4769
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
48-
commit-message: "Generate new version of the linkml model"
70+
commit-message: "Generate new version of the linkml model for ${{ inputs.model }}"
4971
branch: ${{ env.BRANCH_NAME }}
50-
title: "Auto PR: yaml generated from google spreadsheets using schemasheets"
51-
body: "This PR adds a autogenerated yaml file."
72+
title: "Auto PR: ${{ inputs.model }}.yaml generated from google spreadsheets using schemasheets"
73+
body: "This PR adds a autogenerated ${{ inputs.model }}.yaml file."
5274
base: main

0 commit comments

Comments
 (0)