Help with Quarto "Articles" in pkgdown and with GitHub Action

I have a package ("FSA") where I have used a pkgdown website built through a GitHub action for sometime. I am trying to add "articles" (not vignettes) developed with Quarto (not rmarkdown). I started by using usethis::use_article() to set up the general structure. I edited the qmd file and added a few more "articles" with their own qmd files based on the first one. These files are in vignettes/articles/. When I use pkgdown::build_site() or pkgdown::build_articles() locally I get the following error:

── Building articles ──────────────────────────────────────────
Reading vignettes/articles/Computing_PSDs.qmd
Reading vignettes/articles/Computing_Relative_Weights.qmd
Reading vignettes/articles/Fitting_Growth_Functions.qmd
Reading vignettes/articles/Growth_Starting_Values.qmd
Running `quarto render`
Error in `.f()`:
! No built file found for
  vignettes/articles/Computing_PSDs.qmd
Run `rlang::last_trace()` to see where the error occurred.

I did try to move the "article" qmd files to just vignettes\ (rather than vignettes\articles\) and that seemed to work locally (i.e,. it created the website as I would've expected it) but the pkgdown GitHub action I use would not work, wtih the following error:

Error in `purrr::map()`:
ℹ In index: 1.
Caused by error in `quarto::quarto_inspect()`:
✖ Error running quarto cli.
Caused by error:
! System command 'quarto' failed

I am back to the original setup (qmds in vignettes\articles\) as seen in this repo.

I am clearly missing something with respect to Quarto and articles, or Quarto and the pkgdown GitHub action. I have tried look to other packages to emulate but can't seem to find something that works for me.

I am hoping someone may have some advice, even given my ill-formed question.

p.s., I am using R v 4.5.0, RStudio 2024.12.1+563, all packages are up-to-date, Quarto version 1.6.37, and Windows.

1 Like

Here is a working setup, maybe this helps:

1 Like

Thank you for the suggestion and pointer. I think I am going to try creating a "toy" practice package to see if I can get all of the parts to work on that to see if that helps me find the issue on my larger, existing package. I will see if I can use nanoparquet as a sort of template. Thanks again.

1 Like

I created this very simple tester package with one simple function and one article that I initiated with usethis::use_article("test_article.qmd"). The package builds without errors, warnings, or important notes.

Locally usethis::build_site_github_pages() eventually gives this error

── Building articles ──────────────────────────────────────────
Writing articles/index.html
Reading vignettes/articles/test_article.qmd
Running `quarto render`
Error in `.f()`:
! No built file found for
  vignettes/articles/test_article.qmd
Run `rlang::last_trace()` to see where the error occurred.

and the rlang::last_trace() looks like this

Backtrace:
     ▆
  1. └─pkgdown::build_site_github_pages()
  2.   └─pkgdown::build_site(...)
  3.     └─pkgdown:::build_site_local(...)
  4.       └─pkgdown::build_articles(...)
  5.         └─pkgdown:::build_quarto_articles(pkg, quiet = quiet)
  6.           ├─pkgdown:::unwrap_purrr_error(...)
  7.           │ └─base::withCallingHandlers(...)
  8.           └─purrr::walk2(...)
  9.             └─purrr::map2(.x, .y, .f, ..., .progress = .progress)
 10.               └─purrr:::map2_("list", .x, .y, .f, ..., .progress = .progress)
 11.                 ├─purrr:::with_indexed_errors(...)
 12.                 │ └─base::withCallingHandlers(...)
 13.                 ├─purrr:::call_with_cleanup(...)
 14.                 └─pkgdown (local) .f(.x[[i]], .y[[i]], ...)

I think my setup is similar to nanoparquet.

Of course, my pkgdown GitHub action fails similarly.

Make sure you install the development version of pkgdown. Also make sure that you install TestPKG before building the pkgdown site. After that both pkgdown::build_site_github_pages() and pkgdown::build_site() works for me.

On GHA, you also need to use the dev version of pkgdown, e.g.:

Gabor,

The use of the development version of pkgdown, both locally and in DESCRIPTION for use in the GHA solved the problems for my TestPKG package.

However, doing the same for my larger FSA package worked locally (i.e., with pkgdown::build_site(), but my GHA fails as shown here.

 ✔ Updating metadata database ... done
  
  ℹ Creating lockfile '.github/pkg.lock'
  ✖ Creating lockfile '.github/pkg.lock' [10.3s]
  
  Error: 
  ! error in pak subprocess
  Caused by error: 
  ! Could not solve package dependencies:
  * deps::.: Can't install dependency rlib/pkgdown
  * local::.: Can't install dependency rlib/pkgdown
  * any::sessioninfo: dependency conflict
  * any::pkgdown: dependency conflict

I thought that maybe I had package dependencies in my article that needed to be declared in my DESCRIPTION but all were either in my imports or suggested lists, and adding them to config\needs\website also did not help. It does not seem that this error would related to rlib/pkgdown as it worked for my test package, but I am not sure what else to look at.

Thank you so much for your patience and help.

It is r-lib/pkgdown, with a dash:

Gabor,

Thanks for all of your help.

Fixing the r-lib spelling error still did not solve my problem (some details below). It seems like the development version of pkgdown gets installed correctly here ..

✔ Installed pkgdown 2.1.1.9000 (github::r-lib/pkgdown@62d5c5a) (1s)

and quarto gets installed correctly here

Quarto Installed !

But then this error occurs here ....

Error in `purrr::map()`:
ℹ In index: 1.
Caused by error in `quarto::quarto_inspect()`:
✖ Error running quarto cli.
Caused by error:
! System command 'quarto' failed
Backtrace:
     ▆
  1. └─pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
  2.   └─pkgdown::as_pkgdown(pkg, override = list(destination = dest_dir))
  3.     └─pkgdown:::package_vignettes(src_path)
  4.       └─purrr::map(path(base, vig_path), article_metadata)
  5.         └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  6.           ├─purrr:::with_indexed_errors(...)
  7.           │ └─base::withCallingHandlers(...)
  8.           ├─purrr:::call_with_cleanup(...)
  9.           └─pkgdown (local) .f(.x[[i]], ...)
 10.             └─quarto::quarto_inspect(path)
 11.               └─quarto:::quarto_run(args, quarto_bin = quarto_bin)
 12.                 └─base::tryCatch(...)
 13.                   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 14.                     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 15.                       └─value[[3L]](cond)
 16.                         └─cli::cli_abort(msg, call = .call, parent = e)
 17.                           └─rlang::abort(...)
Execution halted
Error: Process completed with exit code 1.

For what it is worth, I manually run the GHA as I don't usually want the GHA to run automatically on my dev branch (the GHA is setup to run from the main branch when a release is created, so that the website matches the current release of the FSA package). Perhaps this is the issue?

I think I am going to try to find another solution to deploying the webpage (deploy from the docs\ folder that will be created locally and pushed to GH??) as I clearly don't understand GHA well enough to troubleshoot this on my own and I can't keep depending on you.

Thanks again for your help, I appreciate your patience and expertise!

Your dev branch also fails locally for me, with:

runner@fv-az816-966:~/work/FSA/FSA$ /usr/local/bin/quarto inspect ./vignettes/articles/Computing_PSDs.qmd
ERROR: Validation of YAML cell metadata failed.
In file ./vignettes/articles/Computing_PSDs.qmd
(line 161, columns 10--12) Field "echo" has value -1, which must instead be `true` or `false`
160: ```{r}
161: #| echo: -1
             ~~~
162: data(YPerchSB1,package="FSAdata")
✖ The value -1 is of type number.
ℹ The error happened in location echo.

EDIT:

Once I fix that, and the same error in another .qmd file, the pkgdown site builds cleanly.

I used the debug-shell action [1] to debug the pkgdown build interactively. It makes GHA debugging much easier.

[1] actions/debug-shell at main · r-hub/actions · GitHub

That fixed it!!! Thanks SO much for Gabor's help, I never would have solved this by myself.

In summary, from the start of this "issue" I needed to do the following things to fix it.

  • Use development version of pkgdown locally.
  • Use development version of pkgdown in the GHA by including r-lib/pkgdown under Confi/Needs/website in my "Description" file.
  • Make sure I used r-lib (with the hyphen) in my "Description" file.
  • Not use echo: -1 in my Quarto documents (this did not get flagged when running locally, though in retrospect I see that RStudio highlighted it at the line number, but may have been found in GH using the "debug-shell" action that Gabor linked to).
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.