Skip to content

generating yaml file #29

generating yaml file

generating yaml file #29

# Generates linkml yaml schema from metadata in googlesheets using schemasheets
name: generating yaml file
on:
workflow_dispatch:
inputs:
model:
description: 'model name'
required: true
type: string
jobs:
generate_libgen_yaml:
runs-on: ubuntu-latest
steps:
- name: Checkout this repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install the required python packages
run: |
python -m pip install .[test]
pip install git+https://github.com/brain-bican/bkbit.git
pip install git+https://github.com/linkml/schemasheets.git@649af7e1
- name: Other installations
run: |
sudo apt-get update
sudo apt-get install -y build-essential git wget curl
# Check if download-dir exists; if not, create it
- name: Check if download-dir exists
run: |
if [ ! -d "linkml-schema/source_${{ inputs.model }}/gsheet_output" ]; then
echo "Directory does not exist. Making directory"
mkdir -p linkml-schema/source_${{ inputs.model }}/gsheet_output
fi
# Check if gsheet.yaml exists
- name: Check if gsheet.yaml exists
run: |
if [ ! -f "linkml-schema/source_${{ inputs.model }}/gsheet.yaml" ]; then
echo "gsheet.yaml does not exist. Exiting"
exit 1
fi
# Generate yaml model
- name: Generate yaml model
run: |
cd linkml-schema
bkbit schema2model -o ${{ inputs.model }}.yaml --gsheet --gsheet-download-dir source_${{ inputs.model }}/gsheet_output source_${{ inputs.model }}/gsheet.yaml --no-inlined
cd ..
# Generate unique branch name
- name: Generate unique branch name
run: |
BRANCH_NAME="autogenerated-yaml-$(date +%Y%m%d%H%M%S)"
echo "Branch created: $BRANCH_NAME"
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
# Create a pull request
- name: Create a Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
commit-message: "Generate new version of the linkml model for ${{ inputs.model }}"
branch: ${{ env.BRANCH_NAME }}
title: "Auto PR: ${{ inputs.model }}.yaml generated from google spreadsheets using schemasheets"
body: "This PR adds a autogenerated ${{ inputs.model }}.yaml file."
base: main