Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelru committed Jun 27, 2024
1 parent 90d2596 commit 4f838fd
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ runs:
packages: |
any::sessioninfo
extra-packages: |
pkgdepends
cli
desc
any::pkgdepends
any::cli
any::desc
install-pandoc: false

- name: Prepare DESCRIPTION file (feature branch)
if: ${{ inputs.skip-desc-branch == 'false' }}
Expand Down Expand Up @@ -147,15 +148,32 @@ runs:
}
cat("::endgroup::\n")
cat("::parse inputs::\n")
lookup_refs <- parse_input("${{ inputs.lookup-refs }}")
cat("::group::Parse inputs\n")
lookup_refs <- parse_input({{ inputs.lookup-refs }})
cli::cli_alert_info("Lookup refs: {.val {lookup_refs}}.")
extra_deps <- parse_input("${{ inputs.extra-deps }}")
extra_deps <- parse_input({{ inputs.extra-deps }})
cli::cli_alert_info("Extra dependencies: {.val {extra_deps}}.")
path <- "${{ inputs.repository-path }}"
path <- "{{ inputs.repository-path }}"
cli::cli_alert_info("Repository path: {.val {path}}.")
cat("::endgroup::\n")
cat("::group::Assertions\n")
if (isFALSE(file.exists(file.path(path, "DESCRIPTION")))) {
cli::cli_alert_danger("{.file DESCRIPTION} file not found in {.path {path}}. Skipping.")
return()
}
if (length(lookup_refs) == 0 || lookup_refs == "") {
cli::cli_alert_danger("No lookup refs provided. Skipping.")
return()
}
parsed_lookup_refs <- pkgdepends::parse_pkg_refs(lookup_refs)
if (any(!vapply(parsed_lookup_refs, is, logical(1), "remote_ref_github"))) {
incorrect_idx <- which(!vapply(parsed_lookup_refs, is, logical(1), "remote_ref_github"))
cli::cli_alert_danger("All lookup refs must be GH refs. Incorrect refs: {.val {lookup_refs[incorrect_idx]}}.")
return()
}
cat("::endgroup::\n")
cat("::group::Modify DESCRIPTION file\n")
current_branch <- get_current_branch()
cli::cli_alert_info("Current branch: {.field {current_branch}}.")
Expand Down Expand Up @@ -265,13 +283,30 @@ runs:
}
cat("::endgroup::\n")
cat("::parse inputs::\n")
cat("::group::Parse inputs\n")
lookup_refs <- parse_input("${{ inputs.lookup-refs }}")
cli::cli_alert_info("Lookup refs: {.val {lookup_refs}}.")
path <- "${{ inputs.repository-path }}"
cli::cli_alert_info("Repository path: {.val {path}}.")
cat("::endgroup::\n")
cat("::group::Assertions\n")
if (isFALSE(file.exists(file.path(path, "DESCRIPTION")))) {
cli::cli_alert_danger("{.file DESCRIPTION} file not found in {.path {path}}. Skipping.")
return()
}
if (length(lookup_refs) == 0 || lookup_refs == "") {
cli::cli_alert_danger("No lookup refs provided. Skipping.")
return()
}
parsed_lookup_refs <- pkgdepends::parse_pkg_refs(lookup_refs)
if (any(!vapply(parsed_lookup_refs, is, logical(1), "remote_ref_github"))) {
incorrect_idx <- which(!vapply(parsed_lookup_refs, is, logical(1), "remote_ref_github"))
cli::cli_alert_danger("All lookup refs must be GH refs. Incorrect refs: {.val {lookup_refs[incorrect_idx]}}.")
return()
}
cat("::endgroup::\n")
cat("::group::Modify DESCRIPTION file\n")
d <- desc::desc(path)
desc_field_create(d, "Config/Needs/DepsDev")
Expand Down

0 comments on commit 4f838fd

Please sign in to comment.