Skip to content

Commit

Permalink
only post a message if CRAN incoming check finds notes
Browse files Browse the repository at this point in the history
  • Loading branch information
cjyetman authored Jan 22, 2025
1 parent a918f5c commit 29bd382
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/R-CMD-check-CRAN-incoming.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,32 @@ jobs:
Sys.setenv("_R_CHECK_CRAN_INCOMING_REMOTE_" = "true")
Sys.setenv("_R_CHECK_CRAN_INCOMING_USE_ASPELL_" = "true")
cat("check-dir-path=", file.path(getwd(), "check"), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
check_results <- rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), build_args = c("--no-manual", "--compact-vignettes=gs+qpdf"), error_on = "warning", check_dir = "check")
check_results <- rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), build_args = c("--no-manual", "--compact-vignettes=gs+qpdf"), error_on = "never", check_dir = "check")
writeLines(paste0("```\n", check_results$stdout, "\n```"), Sys.getenv("GITHUB_STEP_SUMMARY"))
notes <- unlist(strsplit(check_results$notes, "\\n"))
notes <- grep("^checking CRAN incoming feasibility|^Maintainer: |^New submission$|^Version contains large components |^Days since last update: |^$", notes, value = TRUE, invert = TRUE)
writeLines(paste0("R CMD check CRAN incoming feasibility check notes found:\n```\n", paste(notes, collapse = "\n"), "\n```"), "notes.md")
if (length(notes) > 0L) { cat("::error::Notes found in CRAN incoming feasibility check\n"); cat(paste(notes, collapse = "\n")); quit(status=1) }
if (length(notes) > 0L) { cat("::error::Notes found in CRAN incoming feasibility check\n"); cat(paste(notes, collapse = "\n")) }
cat("notes=", length(notes), "\n", file = Sys.getenv("GITHUB_OUTPUT"), sep = "", append = TRUE)
shell: Rscript {0}

- name: Upload 00check.log
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ format('{0}-{1}-r{2}-{3}-00check.log', runner.os, runner.arch, matrix.config.r, matrix.config.id || strategy.job-index ) }}
path: ${{ steps.rcmdcheck.outputs.check-dir-path }}/*.Rcheck/00check.log
if-no-files-found: ignore

- name: Find Comment
if: failure()
if: ${{ steps.rcmdcheck.outputs.notes }}
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'

- name: Create or update comment
if: failure()
if: ${{ steps.rcmdcheck.outputs.notes }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
Expand Down

0 comments on commit 29bd382

Please sign in to comment.