From 25ce5b0f6c8774cfb12173829085997f2dae8dd9 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Thu, 2 Dec 2021 18:02:28 -0600 Subject: [PATCH] Automatically skip when pandoc not installed (#1942) --- .github/workflows/no-pandoc.yaml | 36 ++++++++++++++++++++++++++++++++ R/markdown.R | 6 +++++- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/no-pandoc.yaml diff --git a/.github/workflows/no-pandoc.yaml b/.github/workflows/no-pandoc.yaml new file mode 100644 index 000000000..112c340c6 --- /dev/null +++ b/.github/workflows/no-pandoc.yaml @@ -0,0 +1,36 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: no-pandoc + +jobs: + R-CMD-check: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@v1 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v1 + with: + extra-packages: rcmdcheck + + - uses: r-lib/actions/check-r-package@v1 + with: + build_args: "'--no-manual'" + + - name: Show testthat output + if: always() + run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + diff --git a/R/markdown.R b/R/markdown.R index a20a938b7..43b8a288e 100644 --- a/R/markdown.R +++ b/R/markdown.R @@ -98,7 +98,11 @@ convert_markdown_to_html <- function(in_path, out_path, ...) { } else if (rmarkdown::pandoc_available("1.12.3")) { from <- "markdown_github-hard_line_breaks+tex_math_dollars+tex_math_single_backslash+header_attributes" } else { - stop("Pandoc not available", call. = FALSE) + if (is_testing()) { + testthat::skip("Pandoc not available") + } else { + abort("Pandoc not available") + } } rmarkdown::pandoc_convert(