Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only build favicons locally #2563

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pkgdown (development version)

* `init_site()` will no longer automatically build favicons on CI systems (e.g. GHA). This is an expensive operation that uses an external service so it should only be run locally (#2553).
* `build_home_index()` now reports when rendering the home page (#2544).
* Bootstrap 3 has been deprecated. It was superseded in December 2021, and now we're starting to more directly encourage folks to move away from it.
* Improve HTML5 compliance (#2369):
Expand Down
4 changes: 2 additions & 2 deletions R/build-favicons.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ build_favicons <- function(pkg = ".", overwrite = FALSE) {
cli::cli_abort("API request failed.", .internal = TRUE)
}

tmp <- withr::local_tempdir()
tmp <- withr::local_tempfile()
result <- httr::RETRY(
"GET",
result$favicon$package_url,
httr::write_disk(tmp),
httr::write_disk(tmp, overwrite = TRUE),
quiet = TRUE
)

Expand Down
4 changes: 2 additions & 2 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ init_site <- function(pkg = ".") {
build_bslib(pkg)
}

if (has_logo(pkg) && !has_favicons(pkg)) {
# Building favicons is expensive, so we hopefully only do it once.
# Building favicons is expensive, so we hopefully only do it once, locally
if (has_logo(pkg) && !has_favicons(pkg) && !on_ci()) {
build_favicons(pkg)
}
copy_favicons(pkg)
Expand Down
4 changes: 4 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ section_id <- function(section) {
xml2::xml_attr(h, "id")
}

on_ci <- function() {
isTRUE(as.logical(Sys.getenv("CI", "false")))
}

# yaml ------------------------------------------------------------

print_yaml <- function(x) {
Expand Down
Binary file modified pkgdown/favicon/apple-touch-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified pkgdown/favicon/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading