diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index c84c01f11..11411bea0 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -44,13 +44,9 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: quarto-dev/quarto-actions/setup@v2 - with: - tinytex: true - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-tinytex@v2 - uses: r-lib/actions/setup-r@v2 with: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c3a09d8dc..f9fe26967 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -21,11 +21,13 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - + - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: any::lintr, local::. needs: lint + + - uses: r-lib/actions/setup-tinytex@v2 - name: Lint run: lintr::lint_package() diff --git a/.github/workflows/netlify.yaml b/.github/workflows/netlify.yaml index 3bc4f8ebd..10c6fe1e0 100644 --- a/.github/workflows/netlify.yaml +++ b/.github/workflows/netlify.yaml @@ -16,11 +16,6 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - - name: Set up Quarto - uses: quarto-dev/quarto-actions/setup@v2 - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml index bfe16f8de..0927d63fc 100644 --- a/.github/workflows/pkgdown.yaml +++ b/.github/workflows/pkgdown.yaml @@ -26,12 +26,6 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: quarto-dev/quarto-actions/setup@v2 - with: - tinytex: true - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: r-lib/actions/setup-pandoc@v2 - uses: r-lib/actions/setup-r@v2 @@ -42,6 +36,8 @@ jobs: with: extra-packages: any::pkgdown, local::. needs: website + + - uses: r-lib/actions/setup-tinytex@v2 - name: Build site run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index fc4241e93..eb25110b7 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -21,12 +21,6 @@ jobs: - uses: r-lib/actions/setup-pandoc@v2 - - uses: quarto-dev/quarto-actions/setup@v2 - with: - tinytex: true - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true @@ -35,6 +29,8 @@ jobs: with: extra-packages: any::covr, any::xml2 needs: coverage + + - uses: r-lib/actions/setup-tinytex@v2 - name: Test coverage run: | diff --git a/NEWS.md b/NEWS.md index f1eef26f6..89d7eb4cd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,10 @@ # pkgdown (development version) * Added keyboard shortcut, `/`, to focus search bar (#2423) +* The `BugReports` field can now be an email (@catalamarti, #2275). * New `clean_cache()` function removes the contents of the cache directory (#2718). * pkgdown now depends on R >= 4.0.0 (#2714) +* Updated GitHub Actions advice and workflows around Quarto install (@tanho63, #2743) # pkgdown 2.1.0 diff --git a/R/build-home-index.R b/R/build-home-index.R index d589970b4..70f2764bd 100644 --- a/R/build-home-index.R +++ b/R/build-home-index.R @@ -108,7 +108,7 @@ data_home_sidebar <- function(pkg = ".", call = caller_env()) { "home.sidebar.structure", default = default_sidebar_structure(), call = call - ) + ) # compute all default sections default_components <- list( @@ -122,7 +122,7 @@ data_home_sidebar <- function(pkg = ".", call = caller_env()) { ) needs_components <- setdiff(structure, names(default_components)) - custom_yaml <- config_pluck_sidebar_components(pkg, needs_components, call = call) + custom_yaml <- config_pluck_sidebar_components(pkg, needs_components, call = call) custom_components <- purrr::map(custom_yaml, function(x) { sidebar_section(x$title, markdown_text_block(pkg, x$text)) }) @@ -140,11 +140,11 @@ default_sidebar_structure <- function() { config_pluck_sidebar_components <- function(pkg, new_components, call = caller_env()) { base_path <- "home.sidebar.components" components <- config_pluck_list(pkg, base_path, has_names = new_components, call = call) - + for (name in names(components)) { component <- components[[name]] component_path <- paste0(base_path, ".", name) - + config_pluck_list(pkg, component_path, has_names = c("title", "text"), call = call) config_pluck_string(pkg, paste0(component_path, ".title"), call = call) config_pluck_string(pkg, paste0(component_path, ".text"), call = call) @@ -158,10 +158,15 @@ data_home_sidebar_links <- function(pkg = ".") { repo <- cran_link(pkg$package) links <- config_pluck(pkg, "home.links") + bug_reports <- pkg$desc$get_field("BugReports", default = NULL) + if (grepl("@", bug_reports) && !startsWith(bug_reports, "http")) { + bug_reports <- paste0("mailto:", bug_reports) + } + links <- c( link_url(sprintf(tr_("View on %s"), repo$repo), repo$url), link_url(tr_("Browse source code"), repo_home(pkg)), - link_url(tr_("Report a bug"), pkg$desc$get_field("BugReports", default = NULL)), + link_url(tr_("Report a bug"), bug_reports), purrr::map_chr(links, ~ link_url(.$text, .$href)) ) diff --git a/tests/testthat/_snaps/build-home-index.md b/tests/testthat/_snaps/build-home-index.md index 63e60799b..8de6d29e4 100644 --- a/tests/testthat/_snaps/build-home-index.md +++ b/tests/testthat/_snaps/build-home-index.md @@ -149,3 +149,11 @@ ! In _pkgdown.yml, home.sidebar.components.fancy must have components "title" and "text". 2 missing components: "title" and "text". +# allow email in BugReports + + Code + xpath_xml(html, ".//li/a") + Output + Report a bug + Citing testpackage + diff --git a/tests/testthat/test-build-home-index.R b/tests/testthat/test-build-home-index.R index 283b39126..d452b215f 100644 --- a/tests/testthat/test-build-home-index.R +++ b/tests/testthat/test-build-home-index.R @@ -30,7 +30,7 @@ test_that("math is handled", { expect_equal(xpath_length(html, ".//math"), 1) }) -test_that("data_home() validates yaml metadata", { +test_that("data_home() validates yaml metadata", { data_home_ <- function(...) { pkg <- local_pkgdown_site(meta = list(...)) data_home(pkg) @@ -153,3 +153,10 @@ test_that("cran_unquote works", { "Quoting is CRAN's thing." ) }) + +test_that("allow email in BugReports", { + # currently desc throws a warning if BugReports is an email + pkg <- local_pkgdown_site(desc = list(BugReports = "me@tidyverse.com")) + html <- xml2::read_html(data_home_sidebar(pkg)) + expect_snapshot(xpath_xml(html, ".//li/a")) +}) diff --git a/vignettes/quarto.qmd b/vignettes/quarto.qmd index 2e3afc24f..dd95085dd 100644 --- a/vignettes/quarto.qmd +++ b/vignettes/quarto.qmd @@ -24,14 +24,10 @@ project: render: ['*.qmd'] ``` -### GitHub actions +### GitHub Actions -Currently, you'll need to manually install Quarto in your GitHub actions. ([Hopefully this will change in the future](https://github.com/r-lib/actions/issues/866)). Add the following lines to install quarto: +The `setup-r-dependencies` action will [automatically](https://github.com/r-lib/actions/tree/v2-branch/setup-r-dependencies#usage) install Quarto in your GitHub Actions if a .qmd file is present in your repository (see the `install-quarto` parameter for more details). -```yaml - - name: Set up Quarto - uses: quarto-dev/quarto-actions/setup@v2 -``` ## Limitations