From 48b5e16ccada0e8edcc9a55c98c3f8657ce4c5c7 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 11 May 2023 14:31:01 -0700 Subject: [PATCH 01/39] rename template_dir to community_dir --- .github/workflows/dcc_config_repo_dispatch.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dcc_config_repo_dispatch.yml b/.github/workflows/dcc_config_repo_dispatch.yml index 3ba96b2..7b26307 100644 --- a/.github/workflows/dcc_config_repo_dispatch.yml +++ b/.github/workflows/dcc_config_repo_dispatch.yml @@ -24,7 +24,7 @@ env: DATA_MODEL: https://raw.githubusercontent.com/Sage-Bionetworks/data-models/main/example.model.jsonld # Can be NULL to generate templates for all schemas. Or a space-delimited string of schemas DATA_TYPES: "Biospecimen BulkRNA-seqAssay Patient" - TEMPLATE_DIR: demo/templates + COMMUNITY_DIR: demo concurrency: # cancel the current running workflow from the same branch, PR when a new workflow is triggered @@ -50,4 +50,4 @@ jobs: -H "Authorization: token ${{ secrets.PAT_GITHUB }}" \ -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/Sage-Bionetworks/data_curator_config/dispatches \ - -d '{"event_type": "generate_templates", "client_payload": { "data_model": "${{ env.DATA_MODEL }}", "data_types": "${{ env.DATA_TYPES }}", "template_dir": "${{ env.TEMPLATE_DIR }}"}}' + -d '{"event_type": "generate_templates", "client_payload": { "data_model": "${{ env.DATA_MODEL }}", "data_types": "${{ env.DATA_TYPES }}", "community_dir": "${{ env.COMMUNITY_DIR }}"}}' From ee6b27a3416ea77cc2273180648521e551dc108a Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 1 Nov 2023 14:41:18 -0700 Subject: [PATCH 02/39] add template create workflow --- .github/workflows/create-template-config.yml | 82 ++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/create-template-config.yml diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml new file mode 100644 index 0000000..16d9072 --- /dev/null +++ b/.github/workflows/create-template-config.yml @@ -0,0 +1,82 @@ +on: + repository_dispatch: + types: generate_templates + workflow_dispatch: + inputs: + data_model: + description: URL to a jsonld data model file + required: true + path: + description: Directory to save the template config + required: true + +jobs: + create-template-config: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Install packages + run: install.packages(c("dplyr", "httr", "jsonlite") + shell: Rscript {0} + + - name: Create config file + run: | + library(httr) + library(dplyr) + library(readr) + library(jsonlite) + graph_by_edge_type <- function(url = "https://schematic-dev.api.sagebionetworks.org/v1/schemas/get/graph_by_edge_type", + schema_url, relationship = "requiresDependency") { + req <- httr::GET(url = url, + query = list( + schema_url = schema_url, + relationship = relationship + )) + httr::content(req) + } + format_edge_type <- function(edge_types) { + et <- bind_rows(lapply(edge_types, function(x) data.frame(value=x[[2]], component=x[[1]]))) + et %>% filter(value %in% c("Component", "Filename")) %>% + group_by(component) %>% + summarise(file_based = "Filename" %in% value) + } + get_display_names <- function(qlist) { + if (!"schema_url" %in% names(qlist)) stop("qlist needs element named `schema_url`") + if (!"node_list" %in% names(qlist)) stop("qlist needs at least one element named `node_list`") + httr::GET(url = "https://schematic-dev.api.sagebionetworks.org/v1/schemas/get_nodes_display_names", + query = qlist + ) + } + create_template_config <- function(data_model) { + edges <- graph_by_edge_type(schema_url = data_model) + components <- format_edge_type(edges) + nl <- setNames(as.list(components$component), rep("node_list", length(components$component))) + dnames <- get_display_names(c(schema_url = data_model, nl)) %>% httr::content() + data.frame(component = unlist(nl), display_name = unlist(dnames)) %>% + left_join(components, by = "component") %>% + mutate(record_type = ifelse(file_based, "file", "record")) %>% + select(-file_based) + } + create_json_template_config <- function(data_model, file) { + df <- create_template_config(data_model) + write_json(df, file) + } + create_json_template_config( ${{ inputs.data_model }}, ${{ inputs.path }}) + shell: Rscript {0} + + - name: Open PR + uses: peter-evans/create-pull-request@v5 + with: + title: Automatic Template Config + body: Template updates triggered by repository dispatch from a data model repository. + delete-branch: true + branch-suffix: timestamp + add-paths: | + ${{ inputs.path }} From fe9b8d0bb9ae7b64c8e0f7aaa683a656c727cfb4 Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 1 Nov 2023 14:48:33 -0700 Subject: [PATCH 03/39] add ) --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 16d9072..5ae418f 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -23,7 +23,7 @@ jobs: use-public-rspm: true - name: Install packages - run: install.packages(c("dplyr", "httr", "jsonlite") + run: install.packages(c("dplyr", "httr", "jsonlite")) shell: Rscript {0} - name: Create config file From 37ea57837a3f0ff2f3c606157e050ad4b845039d Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 1 Nov 2023 14:59:26 -0700 Subject: [PATCH 04/39] remove readr --- .github/workflows/create-template-config.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 5ae418f..2880d1a 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -30,7 +30,6 @@ jobs: run: | library(httr) library(dplyr) - library(readr) library(jsonlite) graph_by_edge_type <- function(url = "https://schematic-dev.api.sagebionetworks.org/v1/schemas/get/graph_by_edge_type", schema_url, relationship = "requiresDependency") { From 9847d122e0b62e560b3b8c47a94906c9ed8aea42 Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 1 Nov 2023 15:06:58 -0700 Subject: [PATCH 05/39] quote input env vars --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 2880d1a..b512d80 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -67,7 +67,7 @@ jobs: df <- create_template_config(data_model) write_json(df, file) } - create_json_template_config( ${{ inputs.data_model }}, ${{ inputs.path }}) + create_json_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} - name: Open PR From 068ae5aba3d2860d873fedd1bf722a874afd3254 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 07:46:42 -0700 Subject: [PATCH 06/39] clean up json output to match current config file. use base pipe operator --- .github/workflows/create-template-config.yml | 21 +++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index b512d80..4b0f171 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -42,8 +42,8 @@ jobs: } format_edge_type <- function(edge_types) { et <- bind_rows(lapply(edge_types, function(x) data.frame(value=x[[2]], component=x[[1]]))) - et %>% filter(value %in% c("Component", "Filename")) %>% - group_by(component) %>% + et |> filter(value %in% c("Component", "Filename")) |> + group_by(component) |> summarise(file_based = "Filename" %in% value) } get_display_names <- function(qlist) { @@ -57,15 +57,22 @@ jobs: edges <- graph_by_edge_type(schema_url = data_model) components <- format_edge_type(edges) nl <- setNames(as.list(components$component), rep("node_list", length(components$component))) - dnames <- get_display_names(c(schema_url = data_model, nl)) %>% httr::content() - data.frame(component = unlist(nl), display_name = unlist(dnames)) %>% - left_join(components, by = "component") %>% - mutate(record_type = ifelse(file_based, "file", "record")) %>% + dnames <- get_display_names(c(schema_url = data_model, nl)) |> httr::content() + data.frame(display_name = unlist(dnames), component = unlist(nl)) |> + left_join(components, by = "component") |> + mutate(type = ifelse(file_based, "file", "record")) |> select(-file_based) } create_json_template_config <- function(data_model, file) { df <- create_template_config(data_model) - write_json(df, file) + schematic_version <- httr::GET("https://schematic-dev.api.sagebionetworks.org/v1/version") |> + httr::content() + json <- list( + manifests = df, + service_version = schematic_version, + schema_version = "" + ) + write_json(json, file, pretty = TRUE, auto_unbox = TRUE) } create_json_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} From 35a90bf06fb82aa7a83f98653f7f2f09480cf611 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 07:51:34 -0700 Subject: [PATCH 07/39] name workflow and change PR title --- .github/workflows/create-template-config.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 4b0f171..91fdde9 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -1,3 +1,4 @@ +name: Create DCA Template Config File on: repository_dispatch: types: generate_templates @@ -80,8 +81,8 @@ jobs: - name: Open PR uses: peter-evans/create-pull-request@v5 with: - title: Automatic Template Config - body: Template updates triggered by repository dispatch from a data model repository. + 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: | From 8251f182db9c4698ddb936dd3ee9b7f8a3efc376 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 07:59:43 -0700 Subject: [PATCH 08/39] change component to schema_name --- .github/workflows/create-template-config.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 91fdde9..9a3d78e 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -42,9 +42,9 @@ jobs: httr::content(req) } format_edge_type <- function(edge_types) { - et <- bind_rows(lapply(edge_types, function(x) data.frame(value=x[[2]], component=x[[1]]))) - et |> filter(value %in% c("Component", "Filename")) |> - group_by(component) |> + et <- bind_rows(lapply(edge_types, function(x) data.frame(value=x[[2]], schema_name=x[[1]]))) + et |> filter(value %in% c("schema_name", "Filename")) |> + group_by(schema_name) |> summarise(file_based = "Filename" %in% value) } get_display_names <- function(qlist) { @@ -56,11 +56,11 @@ jobs: } create_template_config <- function(data_model) { edges <- graph_by_edge_type(schema_url = data_model) - components <- format_edge_type(edges) - nl <- setNames(as.list(components$component), rep("node_list", length(components$component))) + schema_names <- format_edge_type(edges) + nl <- setNames(as.list(schema_names$schema_name), rep("node_list", length(schema_names$schema_name))) dnames <- get_display_names(c(schema_url = data_model, nl)) |> httr::content() - data.frame(display_name = unlist(dnames), component = unlist(nl)) |> - left_join(components, by = "component") |> + data.frame(display_name = unlist(dnames), schema_name = unlist(nl)) |> + left_join(schema_names, by = "schema_name") |> mutate(type = ifelse(file_based, "file", "record")) |> select(-file_based) } From cebb2c2961a559f840275c056e90bebac70cff6a Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 08:10:04 -0700 Subject: [PATCH 09/39] fix filter for components and filenames --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 9a3d78e..73cb366 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -43,7 +43,7 @@ jobs: } format_edge_type <- function(edge_types) { et <- bind_rows(lapply(edge_types, function(x) data.frame(value=x[[2]], schema_name=x[[1]]))) - et |> filter(value %in% c("schema_name", "Filename")) |> + et |> filter(value %in% c("Component", "Filename")) |> group_by(schema_name) |> summarise(file_based = "Filename" %in% value) } From 55af3f0ed8b2ac71df674784c0dc6c5e6fbdb3a9 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 08:18:07 -0700 Subject: [PATCH 10/39] change array name to manifest_schemas to match existing format --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 73cb366..4f9e88b 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -69,7 +69,7 @@ jobs: schematic_version <- httr::GET("https://schematic-dev.api.sagebionetworks.org/v1/version") |> httr::content() json <- list( - manifests = df, + manifest_schemas = df, service_version = schematic_version, schema_version = "" ) From 2384257bb404930c7f7b68538f73878d48e2eb2c Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 08:30:32 -0700 Subject: [PATCH 11/39] Add step to validate json --- .github/workflows/create-template-config.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 4f9e88b..ffaa1ed 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -15,7 +15,7 @@ jobs: create-template-config: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -77,7 +77,18 @@ jobs: } create_json_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} + + - name: Checkout DCA Config Repo for Schema + uses: actions/checkout@v4 + with: + repository: 'Sage-Bionetworks/data_curator_config' + - name: Validate Config File + uses: docker://orrosenblatt/validate-json-action:latest + env: + INPUT_SCHEMA: 'Sage-Bionetworks/schemas/dca_template_config.schema.json' + INPUT_JSONS: ${{ inputs.path }} + - name: Open PR uses: peter-evans/create-pull-request@v5 with: From 224e7701c642db86dfb620a0f1aa046d90c8d0ff Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 08:41:05 -0700 Subject: [PATCH 12/39] checkout config repo side by side --- .github/workflows/create-template-config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index ffaa1ed..5d1159e 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -82,11 +82,12 @@ jobs: uses: actions/checkout@v4 with: repository: 'Sage-Bionetworks/data_curator_config' + path: 'data_curator_config' - name: Validate Config File uses: docker://orrosenblatt/validate-json-action:latest env: - INPUT_SCHEMA: 'Sage-Bionetworks/schemas/dca_template_config.schema.json' + INPUT_SCHEMA: 'data_curator_config/schemas/dca_template_config.schema.json' INPUT_JSONS: ${{ inputs.path }} - name: Open PR From eabf04abf2aed84f904b6b27dc05ee49b92efc8a Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 08:50:09 -0700 Subject: [PATCH 13/39] don't run on psuh to main --- .github/workflows/dcc_config_repo_dispatch.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/dcc_config_repo_dispatch.yml b/.github/workflows/dcc_config_repo_dispatch.yml index 7b26307..c32ad8c 100644 --- a/.github/workflows/dcc_config_repo_dispatch.yml +++ b/.github/workflows/dcc_config_repo_dispatch.yml @@ -11,9 +11,6 @@ name: dcc_config_repo_dispatch # Can specify other branches or triggers for this workflow # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows on: - push: - branches: - - main pull_request: types: - closed # requires if_merged job below to run only during a merged PR From 901e82f318538f62c292c703fb3ba8213d18cc6a Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 08:50:23 -0700 Subject: [PATCH 14/39] check out config-refactor branch of config repo --- .github/workflows/create-template-config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 5d1159e..6288fa8 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -82,6 +82,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'Sage-Bionetworks/data_curator_config' + ref: 'config-refactor' path: 'data_curator_config' - name: Validate Config File From 12ee4da43b8383337af2d6ac45515131ce3e53c9 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 10:06:11 -0700 Subject: [PATCH 15/39] checkout dev branch of data_curator_config for schema --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 6288fa8..b8ae15c 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -82,7 +82,7 @@ jobs: uses: actions/checkout@v4 with: repository: 'Sage-Bionetworks/data_curator_config' - ref: 'config-refactor' + ref: 'dev' path: 'data_curator_config' - name: Validate Config File From afecd92480eb09837d277053298dcd93514c41d5 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 13:38:47 -0700 Subject: [PATCH 16/39] Use datacurator package to create config --- .github/workflows/create-template-config.yml | 52 ++------------------ 1 file changed, 4 insertions(+), 48 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index b8ae15c..dca23ee 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -24,58 +24,14 @@ jobs: use-public-rspm: true - name: Install packages - run: install.packages(c("dplyr", "httr", "jsonlite")) + run: | + install.packages("remotes") + remotes::install_github("Sage-Bionetworks/data_curator", "rc.23.11.1") shell: Rscript {0} - name: Create config file run: | - library(httr) - library(dplyr) - library(jsonlite) - graph_by_edge_type <- function(url = "https://schematic-dev.api.sagebionetworks.org/v1/schemas/get/graph_by_edge_type", - schema_url, relationship = "requiresDependency") { - req <- httr::GET(url = url, - query = list( - schema_url = schema_url, - relationship = relationship - )) - httr::content(req) - } - format_edge_type <- function(edge_types) { - et <- bind_rows(lapply(edge_types, function(x) data.frame(value=x[[2]], schema_name=x[[1]]))) - et |> filter(value %in% c("Component", "Filename")) |> - group_by(schema_name) |> - summarise(file_based = "Filename" %in% value) - } - get_display_names <- function(qlist) { - if (!"schema_url" %in% names(qlist)) stop("qlist needs element named `schema_url`") - if (!"node_list" %in% names(qlist)) stop("qlist needs at least one element named `node_list`") - httr::GET(url = "https://schematic-dev.api.sagebionetworks.org/v1/schemas/get_nodes_display_names", - query = qlist - ) - } - create_template_config <- function(data_model) { - edges <- graph_by_edge_type(schema_url = data_model) - schema_names <- format_edge_type(edges) - nl <- setNames(as.list(schema_names$schema_name), rep("node_list", length(schema_names$schema_name))) - dnames <- get_display_names(c(schema_url = data_model, nl)) |> httr::content() - data.frame(display_name = unlist(dnames), schema_name = unlist(nl)) |> - left_join(schema_names, by = "schema_name") |> - mutate(type = ifelse(file_based, "file", "record")) |> - select(-file_based) - } - create_json_template_config <- function(data_model, file) { - df <- create_template_config(data_model) - schematic_version <- httr::GET("https://schematic-dev.api.sagebionetworks.org/v1/version") |> - httr::content() - json <- list( - manifest_schemas = df, - service_version = schematic_version, - schema_version = "" - ) - write_json(json, file, pretty = TRUE, auto_unbox = TRUE) - } - create_json_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") + datacurator::write_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} - name: Checkout DCA Config Repo for Schema From 22fa7566277ecaf293f831efd7a4af26b444b5b3 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 13:45:08 -0700 Subject: [PATCH 17/39] run everything in one step --- .github/workflows/create-template-config.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index dca23ee..a17ce3d 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -23,17 +23,13 @@ jobs: with: use-public-rspm: true - - name: Install packages - run: | - install.packages("remotes") - remotes::install_github("Sage-Bionetworks/data_curator", "rc.23.11.1") - shell: Rscript {0} - - name: Create config file run: | + install.packages("remotes") + remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1") datacurator::write_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} - + - name: Checkout DCA Config Repo for Schema uses: actions/checkout@v4 with: From 1df93689508e943a2ca489f11e352ece3cbe7fe5 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 13:50:29 -0700 Subject: [PATCH 18/39] use github token for install_github --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index a17ce3d..3f4be6c 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -26,7 +26,7 @@ jobs: - name: Create config file run: | install.packages("remotes") - remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1") + remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1", auth_token = ${{ secrets.GITHUB_TOKEN }}) datacurator::write_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} From 93577e3eaa1b604d742bc9d7f656ea2757c1e46f Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 13:54:40 -0700 Subject: [PATCH 19/39] use github.token context --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 3f4be6c..1b9fd5c 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -26,7 +26,7 @@ jobs: - name: Create config file run: | install.packages("remotes") - remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1", auth_token = ${{ secrets.GITHUB_TOKEN }}) + remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1", auth_token = "$ {{ github.token }}" ) datacurator::write_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} From 89940663b80386c8077ae14254478bc17037c46c Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 2 Nov 2023 14:06:59 -0700 Subject: [PATCH 20/39] remove extra space --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 1b9fd5c..9755f2c 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -26,7 +26,7 @@ jobs: - name: Create config file run: | install.packages("remotes") - remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1", auth_token = "$ {{ github.token }}" ) + remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1", auth_token = "${{ github.token }}" ) datacurator::write_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} From 4326bec2f2090f3703906e2d33def0c971f672a0 Mon Sep 17 00:00:00 2001 From: afwillia Date: Tue, 7 Nov 2023 08:14:26 -0800 Subject: [PATCH 21/39] use write_dca_template_config --- .github/workflows/create-template-config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 9755f2c..0981715 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -27,7 +27,7 @@ jobs: run: | install.packages("remotes") remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1", auth_token = "${{ github.token }}" ) - datacurator::write_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") + datacurator::write_dca_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") shell: Rscript {0} - name: Checkout DCA Config Repo for Schema From 6af0800f044e240efefcd42c3db8debee8fcb0b9 Mon Sep 17 00:00:00 2001 From: afwillia Date: Tue, 7 Nov 2023 10:27:00 -0800 Subject: [PATCH 22/39] Add explanatory comments to the top --- .github/workflows/create-template-config.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 0981715..c482177 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -1,7 +1,23 @@ +# -------------------------------------------------------------------------------------------------- +# GitHub Action to create a DCA template config json file for a data model +# +# This action creates a json file named with the `path` 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 +# +# -------------------------------------------------------------------------------------------------- + name: Create DCA Template Config File on: - repository_dispatch: - types: generate_templates workflow_dispatch: inputs: data_model: From 84c819162a9092f82234fff0f5b0013a85a78a93 Mon Sep 17 00:00:00 2001 From: afwillia Date: Thu, 9 Nov 2023 13:55:01 -0800 Subject: [PATCH 23/39] Add include_schemas and exclude_schemas --- .github/workflows/create-template-config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index c482177..7370083 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -14,6 +14,10 @@ # 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_schemas` or +# `exclude_schemas` in the call to `datacurator::write_dca_template_config()` +# # -------------------------------------------------------------------------------------------------- name: Create DCA Template Config File @@ -26,6 +30,12 @@ on: path: description: Directory to save the template config required: true + include_schemas: + description: Comma-separated string of schemas to include in output. Must be empty if using exclude_schemas. + required: false + exlude_schemas: + description: Commma-separated string of schemas to exclude from output. Must be empty if using include_schemas. + required: false jobs: create-template-config: From 07023c0696de703fd802cd7d44f7a62c20f22bac Mon Sep 17 00:00:00 2001 From: afwillia Date: Fri, 10 Nov 2023 12:38:09 -0800 Subject: [PATCH 24/39] Create a workflow using dca-template-config-action --- create-template-config-v2.yml | 79 +++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 create-template-config-v2.yml diff --git a/create-template-config-v2.yml b/create-template-config-v2.yml new file mode 100644 index 0000000..131ed51 --- /dev/null +++ b/create-template-config-v2.yml @@ -0,0 +1,79 @@ +# -------------------------------------------------------------------------------------------------- +# GitHub Action to create a DCA template config json file for a data model +# +# This action creates a json file named with the `path` 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_schemas` or +# `exclude_schemas` in the call to `datacurator::write_dca_template_config()` +# +# -------------------------------------------------------------------------------------------------- + +name: Create DCA Template Config File +on: + workflow_dispatch: + inputs: + data_model: + description: URL to a jsonld data model file + required: true + path: + description: Directory to save the template config + required: true + include_schemas: + description: Comma-separated string of schemas to include in output. Must be empty if using exclude_schemas. + required: false + exlude_schemas: + description: Commma-separated string of schemas to exclude from output. Must be empty if using include_schemas. + required: false + +jobs: + create-template-config: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + use-public-rspm: true + + - name: Create config file + uses: sage-bionetworks/dca-template-config-action@main + with: + data-model: ${{ inputs.data_model }} + path: ${{ inputs.path }} + + - 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: 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.path }} + + - 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.path }} From 219c4f87c66937e8e247fb85433a575a3f795b93 Mon Sep 17 00:00:00 2001 From: afwillia Date: Fri, 10 Nov 2023 12:39:20 -0800 Subject: [PATCH 25/39] move workflow to github dir --- .../workflows/create-template-config-v2.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename create-template-config-v2.yml => .github/workflows/create-template-config-v2.yml (100%) diff --git a/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml similarity index 100% rename from create-template-config-v2.yml rename to .github/workflows/create-template-config-v2.yml From 0cda86456a646b200af5ac3854d83e1defc58fed Mon Sep 17 00:00:00 2001 From: afwillia Date: Fri, 10 Nov 2023 12:40:04 -0800 Subject: [PATCH 26/39] change name of workflow to distinguish from original --- .github/workflows/create-template-config-v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index 131ed51..a16b0ac 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -20,7 +20,7 @@ # # -------------------------------------------------------------------------------------------------- -name: Create DCA Template Config File +name: DCA Template Config File on: workflow_dispatch: inputs: From 7fe6961e97452dfd38bf0f0c6581dda8ca8d0fbd Mon Sep 17 00:00:00 2001 From: afwillia Date: Fri, 10 Nov 2023 12:42:41 -0800 Subject: [PATCH 27/39] remove set up R action --- .github/workflows/create-template-config-v2.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index a16b0ac..a057ae3 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -43,12 +43,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - name: Create config file uses: sage-bionetworks/dca-template-config-action@main with: From 523a1b349858dd4de87644921e4693d024c10c79 Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 11:53:46 -0800 Subject: [PATCH 28/39] use env instead of with --- .github/workflows/create-template-config-v2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index a057ae3..7c15a57 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -44,8 +44,8 @@ jobs: - uses: actions/checkout@v4 - name: Create config file - uses: sage-bionetworks/dca-template-config-action@main - with: + uses: sage-bionetworks/dca-template-config-action@intial-setup + env: data-model: ${{ inputs.data_model }} path: ${{ inputs.path }} From e58ffa7368879e81e8a3dfc61891de5fd7c501fa Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 11:55:25 -0800 Subject: [PATCH 29/39] use main branch --- .github/workflows/create-template-config-v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index 7c15a57..e3a4fac 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -44,7 +44,7 @@ jobs: - uses: actions/checkout@v4 - name: Create config file - uses: sage-bionetworks/dca-template-config-action@intial-setup + uses: sage-bionetworks/dca-template-config-action@main env: data-model: ${{ inputs.data_model }} path: ${{ inputs.path }} From 051726932da9a5e905ad09a92b973accca17e013 Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 12:02:48 -0800 Subject: [PATCH 30/39] use data_model --- .github/workflows/create-template-config-v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index e3a4fac..affc105 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -46,7 +46,7 @@ jobs: - name: Create config file uses: sage-bionetworks/dca-template-config-action@main env: - data-model: ${{ inputs.data_model }} + data_model: ${{ inputs.data_model }} path: ${{ inputs.path }} - name: Checkout DCA Config Repo for Schema From c6d8878b223a26aaa496e06f289037a20afc487b Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 12:42:14 -0800 Subject: [PATCH 31/39] give write permission --- .github/workflows/create-template-config-v2.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index affc105..5a5b3bb 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -37,6 +37,8 @@ on: description: Commma-separated string of schemas to exclude from output. Must be empty if using include_schemas. required: false +permissions: write-all + jobs: create-template-config: runs-on: ubuntu-latest From 224c03d92a7acb78c03d05d1514d6ee08571c58b Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 14:35:24 -0800 Subject: [PATCH 32/39] checkout repo and then write config --- .github/workflows/create-template-config-v2.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index 5a5b3bb..7b063e7 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -45,18 +45,18 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Create config file - uses: sage-bionetworks/dca-template-config-action@main - env: - data_model: ${{ inputs.data_model }} - path: ${{ inputs.path }} - - 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 }} + path: ${{ inputs.path }} - name: Validate Config File uses: docker://orrosenblatt/validate-json-action:latest From 75af16fb6cd96d417e8e4f8383382d9205f726eb Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 16:32:11 -0800 Subject: [PATCH 33/39] make path file --- .github/workflows/create-template-config-v2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index 7b063e7..8f85b61 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -56,7 +56,7 @@ jobs: uses: sage-bionetworks/dca-template-config-action@main env: data_model: ${{ inputs.data_model }} - path: ${{ inputs.path }} + path: ${{ inputs.file }} - name: Validate Config File uses: docker://orrosenblatt/validate-json-action:latest From 08c4db6fd5de7f18f25c900ca573d7c0ad5b21b2 Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 16:34:11 -0800 Subject: [PATCH 34/39] really change path to file --- .github/workflows/create-template-config-v2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index 8f85b61..b6c6280 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -27,7 +27,7 @@ on: data_model: description: URL to a jsonld data model file required: true - path: + file: description: Directory to save the template config required: true include_schemas: @@ -56,7 +56,7 @@ jobs: uses: sage-bionetworks/dca-template-config-action@main env: data_model: ${{ inputs.data_model }} - path: ${{ inputs.file }} + file: ${{ inputs.file }} - name: Validate Config File uses: docker://orrosenblatt/validate-json-action:latest From d123375fe13a1e45f5aa9ec6ca1a5f7304dfacbd Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 16:37:14 -0800 Subject: [PATCH 35/39] change path to file --- .github/workflows/create-template-config-v2.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml index b6c6280..71008dd 100644 --- a/.github/workflows/create-template-config-v2.yml +++ b/.github/workflows/create-template-config-v2.yml @@ -1,7 +1,7 @@ # -------------------------------------------------------------------------------------------------- # GitHub Action to create a DCA template config json file for a data model # -# This action creates a json file named with the `path` input argument using +# 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. @@ -36,8 +36,6 @@ on: exlude_schemas: description: Commma-separated string of schemas to exclude from output. Must be empty if using include_schemas. required: false - -permissions: write-all jobs: create-template-config: @@ -62,7 +60,7 @@ jobs: uses: docker://orrosenblatt/validate-json-action:latest env: INPUT_SCHEMA: 'data_curator_config/schemas/dca_template_config.schema.json' - INPUT_JSONS: ${{ inputs.path }} + INPUT_JSONS: ${{ inputs.file }} - name: Open PR uses: peter-evans/create-pull-request@v5 @@ -72,4 +70,4 @@ jobs: delete-branch: true branch-suffix: timestamp add-paths: | - ${{ inputs.path }} + ${{ inputs.file }} From 35354637824ca4a127fabd03eb6bd313a3703271 Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 16:41:33 -0800 Subject: [PATCH 36/39] Now that template github action works, just use one workflow file --- .../workflows/create-template-config-v2.yml | 73 ------------------- .github/workflows/create-template-config.yml | 31 +++----- 2 files changed, 12 insertions(+), 92 deletions(-) delete mode 100644 .github/workflows/create-template-config-v2.yml diff --git a/.github/workflows/create-template-config-v2.yml b/.github/workflows/create-template-config-v2.yml deleted file mode 100644 index 71008dd..0000000 --- a/.github/workflows/create-template-config-v2.yml +++ /dev/null @@ -1,73 +0,0 @@ -# -------------------------------------------------------------------------------------------------- -# 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_schemas` or -# `exclude_schemas` 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_schemas: - description: Comma-separated string of schemas to include in output. Must be empty if using exclude_schemas. - required: false - exlude_schemas: - description: Commma-separated string of schemas to exclude from output. Must be empty if using include_schemas. - required: false - -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 }} - - - 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 }} diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 7370083..71008dd 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -1,7 +1,7 @@ # -------------------------------------------------------------------------------------------------- # GitHub Action to create a DCA template config json file for a data model # -# This action creates a json file named with the `path` input argument using +# 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. @@ -20,14 +20,14 @@ # # -------------------------------------------------------------------------------------------------- -name: Create DCA Template Config File +name: DCA Template Config File on: workflow_dispatch: inputs: data_model: description: URL to a jsonld data model file required: true - path: + file: description: Directory to save the template config required: true include_schemas: @@ -36,38 +36,31 @@ on: exlude_schemas: description: Commma-separated string of schemas to exclude from output. Must be empty if using include_schemas. required: false - + jobs: create-template-config: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - use-public-rspm: true - - - name: Create config file - run: | - install.packages("remotes") - remotes::install_github("Sage-Bionetworks/data_curator@rc.23.11.1", auth_token = "${{ github.token }}" ) - datacurator::write_dca_template_config( "${{ inputs.data_model }}", "${{ inputs.path }}") - shell: Rscript {0} - - 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 }} - 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.path }} + INPUT_JSONS: ${{ inputs.file }} - name: Open PR uses: peter-evans/create-pull-request@v5 @@ -77,4 +70,4 @@ jobs: delete-branch: true branch-suffix: timestamp add-paths: | - ${{ inputs.path }} + ${{ inputs.file }} From 9c5865bb54474ffa966a67a59c4f95a03932b347 Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 16:46:10 -0800 Subject: [PATCH 37/39] add include and exclude schemas --- .github/workflows/create-template-config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 71008dd..ba93585 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -55,6 +55,8 @@ jobs: env: data_model: ${{ inputs.data_model }} file: ${{ inputs.file }} + include_schemas: ${{ inputs.include_schemas }} + exclude_schemas: ${{ inputs.exclude_schemas }} - name: Validate Config File uses: docker://orrosenblatt/validate-json-action:latest From 77f40f3b3dfcc6fd8a294da9b03397f49440a1e2 Mon Sep 17 00:00:00 2001 From: afwillia Date: Mon, 13 Nov 2023 17:08:36 -0800 Subject: [PATCH 38/39] fix typo in exclude --- .github/workflows/create-template-config.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index ba93585..8a94e18 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -31,10 +31,10 @@ on: description: Directory to save the template config required: true include_schemas: - description: Comma-separated string of schemas to include in output. Must be empty if using exclude_schemas. + description: Space-separated string of schemas to include in output. Must be empty if using exclude_schemas. required: false - exlude_schemas: - description: Commma-separated string of schemas to exclude from output. Must be empty if using include_schemas. + exclude_schemas: + description: Space-separated string of schemas to exclude from output. Must be empty if using include_schemas. required: false jobs: From a4d84f964893ab095238da5dd9a4f30cb66d344c Mon Sep 17 00:00:00 2001 From: afwillia Date: Wed, 15 Nov 2023 13:16:37 -0800 Subject: [PATCH 39/39] instead of schema say data_type --- .github/workflows/create-template-config.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/create-template-config.yml b/.github/workflows/create-template-config.yml index 8a94e18..844776e 100644 --- a/.github/workflows/create-template-config.yml +++ b/.github/workflows/create-template-config.yml @@ -15,8 +15,8 @@ # 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_schemas` or -# `exclude_schemas` in the call to `datacurator::write_dca_template_config()` +# "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()` # # -------------------------------------------------------------------------------------------------- @@ -30,11 +30,11 @@ on: file: description: Directory to save the template config required: true - include_schemas: - description: Space-separated string of schemas to include in output. Must be empty if using exclude_schemas. + 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_schemas: - description: Space-separated string of schemas to exclude from output. Must be empty if using include_schemas. + exclude_data_types: + description: Space-separated string of data types to exclude from output. Must be empty if using include_data_types. required: false jobs: @@ -55,8 +55,8 @@ jobs: env: data_model: ${{ inputs.data_model }} file: ${{ inputs.file }} - include_schemas: ${{ inputs.include_schemas }} - exclude_schemas: ${{ inputs.exclude_schemas }} + include_data_types: ${{ inputs.include_data_types }} + exclude_data_types: ${{ inputs.exclude_data_types }} - name: Validate Config File uses: docker://orrosenblatt/validate-json-action:latest