Skip to content

Commit

Permalink
use json format for inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Bai-Li-NOAA committed Nov 18, 2024
1 parent 2975b0d commit bee72f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/call-r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,4 @@ jobs:
call-workflow:
uses: nmfs-fish-tools/ghactions4r/.github/workflows/r-cmd-check.yml@add-input-option-workflows
with:
additional_args: 'sudo apt-get update'
additional_args: 'sudo apt-get install -y libcurl4-openssl-dev'
additional_args: 'sudo add-apt-repository ppa:ubuntu-toolchain-r/test'
additional_args: 'sudo apt-get install --only-upgrade libstdc++6'
additional_args: ["sudo apt-get update","sudo apt-get install -y libcurl4-openssl-dev","sudo add-apt-repository ppa:ubuntu-toolchain-r/test","sudo apt-get install --only-upgrade libstdc++6"]
2 changes: 1 addition & 1 deletion .github/workflows/r-cmd-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

- name: run additional args
run: |
${{ inputs.additional_args }}
${{ fromJson(inputs.additional_args) }}
- uses: r-lib/actions/setup-r@v2
with:
Expand Down
7 changes: 4 additions & 3 deletions R/use_r_workflows.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use_r_cmd_check <- function(workflow_name = "call-r-cmd-check.yml",
url = url_name
)

if (depends_on_tmb | !is.null(args)) {
if (depends_on_tmb | !is.null(additional_args)) {
path_to_yml <- file.path(".github", "workflows", workflow_name)
txt <- readLines(path_to_yml)
if (use_full_build_matrix) {
Expand All @@ -45,8 +45,9 @@ use_r_cmd_check <- function(workflow_name = "call-r-cmd-check.yml",
}

if (depends_on_tmb) txt <- append(txt, " depends_on_tmb: true", prev_line)
if (!is.null(args)) {
txt <- append(txt, paste0(" additional_args: '", additional_args, "'"), prev_line)
if (!is.null(additional_args)) {
json_inputs <- jsonlite::toJSON(additional_args)
txt <- append(txt, paste0(" additional_args: ", json_inputs), prev_line)
}
writeLines(txt, path_to_yml)
}
Expand Down

0 comments on commit bee72f1

Please sign in to comment.