-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (74 loc) · 3.25 KB
/
create-template-config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# --------------------------------------------------------------------------------------------------
# GitHub Action to create a DCA template config json file for a data model
#
# This action creates a json file named with the `file` input argument using
# the data model supplied to the `data_model` argument. It will validate the
# json file against DCA's template config schema. Finally, it will create a PR
# in the repo for the new file.
#
# Copy this into your data model repo .github/workflow directory.
# Your repo settings must have Actions enabled and must allow GitHub Actions to
# create and approve pull requests.
#
# By default, this action runs by workflow dispatch. But it can be configured
# to run on other triggers. Consult the github doc below for more information.
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch
#
# The resulting file with contain one entry for each attribute in the data model that `dependsOn`
# "Component". To include a subset of these attributes, use either `include_data_types` or
# `exclude_data_types` in the call to `datacurator::write_dca_template_config()`
#
# --------------------------------------------------------------------------------------------------
name: DCA Template Config File
on:
workflow_dispatch:
inputs:
data_model:
description: URL to a jsonld data model file
required: true
file:
description: Directory to save the template config
required: true
include_data_types:
description: Space-separated string of data types to include in output. Must be empty if using exclude_data_types.
required: false
exclude_data_types:
description: Space-separated string of data types to exclude from output. Must be empty if using include_data_types.
required: false
data_model_labels:
description: How schematic gets data model labels. Defaults `class_label`.
default: 'class_label'
required: true
jobs:
create-template-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout DCA Config Repo for Schema
uses: actions/checkout@v4
with:
repository: 'Sage-Bionetworks/data_curator_config'
ref: 'dev'
path: 'data_curator_config'
- name: Create config file
uses: sage-bionetworks/dca-template-config-action@main
env:
data_model: ${{ inputs.data_model }}
file: ${{ inputs.file }}
include_data_types: ${{ inputs.include_data_types }}
exclude_data_types: ${{ inputs.exclude_data_types }}
data_model_labels: ${{ inputs.data_model_labels }}
- name: Validate Config File
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: 'data_curator_config/schemas/dca_template_config.schema.json'
INPUT_JSONS: ${{ inputs.file }}
- name: Open PR
uses: peter-evans/create-pull-request@v5
with:
title: Update DCA Template Config File
body: Recreate the json file that populates the DCA template dropdown menu.
delete-branch: true
branch-suffix: timestamp
add-paths: |
${{ inputs.file }}