Draft

Some Civitas notebooks should only be run locally

A demonstration of our practice with some Civitas notebooks that cannot be run in GitHub Pages.
Author
Affiliation
Published

July 25, 2025

(Work-In-Progress Draft)

Usually, when we wish to create Clojure Civitas posts, we enjoy the fact that Civitas runs our notebooks in the GitHub Actions as it renders the website.

While this is the default behavior, sometimes, we cannot expect our notebooks to be run in GitHub Actions. For example, they may depend on a local file or service.

This notebook, for example, assumes that you have a local secrets file, and it will not work without it!

(slurp "/home/daslu/my-secret.txt")
"this is my secret!!!!!\n"

If you are the author of such a notebook, the recommended practice is to render the notebook locally usinc Clay in Quarto .qmd format, and include that file in your Pull Request.

The .qmd file is all that Civitas needs to include your notebook in the website. As long as the .qmd file is included in the PR, and is not older than your source .clj file, Civitas will just rely on it and not even try to generate it in GitHub Actions.

To do that, you will need to make the file locally with a Quarto target.

Here are two ways to do that:

  1. Use the command line. Note that here, we use the path to the notebook, relative to src.
clojure -M:clay -A:markdown scicloj/clay/skip_if_unchanged_example.clj
  1. … Or do the same in Clojure code.
(comment
  (require '[scicloj.clay.v2.api :as clay])
  (clay/make! {:source-path "scicloj/clay/skip_if_unchanged_example.clj"
               :aliases [:markdown]}))

Now, need to git add the generated qmd file. Here is how.

(WIP)

source: src/scicloj/clay/skip_if_unchanged_example.clj