Keep a repo's docs on paper
A repo’s paper.yml says which of its markdown files go to your device. Reading copies stay current as the files change, and proofs go out one round at a time. Something has to do the sending whenever the repo changes, and you pick who:
- Your laptop (
placed_by: local):freehand watchsees a new commit and sends. No GitHub setup, but it only runs while the computer is on. - GitHub Actions (
placed_by: workflow, the default): a workflow renders on every push and the freehand script places the PDFs in Drive within a minute. It works with every computer off.
A repo is sent by one of them, never both.
1. Write the paper.yml
Section titled “1. Write the paper.yml”Put this at the repo’s root. Every part is optional:
copies: # kept current on the device; marks become notes - docs/**/*.mdfolder: study/my-repo # where this repo's copies go, under the device's documents folderproofs: # one round each, and the line is removed once it's sent - docs/plan.mdedits: pull-request # how a proof's edits come back: pull-request, or mainplaced_by: local # who sends: local (your laptop) or workflow (CI, the default)The whole format is in the paper.yml reference.
2. See what would go
Section titled “2. See what would go”From the repo’s root:
freehand paper --planIt lists the copies whose words, pictures or renderer changed since they were last sent, and the proofs waiting in the queue.
3a. Send from your laptop
Section titled “3a. Send from your laptop”Name the repo in your watch config, ~/.freehand/config.yml:
repos: [~/notes](freehand init --repo ~/notes writes that for you.) Then send now and keep sending:
freehand paper --place "<your drive>" # send what's due, right nowfreehand watch # then send whenever a new commit landsTo keep it running without a terminal, see run the watcher in the background. The watcher writes freehand/paper.json (what was sent, so a copy goes again only when it changed) but leaves committing it to you.
3b. Send from GitHub Actions
Section titled “3b. Send from GitHub Actions”-
Add the workflow. In a checkout of the repo:
Terminal window freehand add-repo .It writes a
paper.ymlif there isn’t one, and the workflow.github/workflows/send-to-paper.yml, which calls Freehand’s shared workflow. It commits nothing: commit it the way the repo likes. An existingpaper.ymlis never changed. -
Give the script access. In the freehand script’s Project Settings, Script properties, add
GITHUB_REPO(owner/name) andGITHUB_TOKEN, a fine-grained token for that one repo with Actions read and write. The script uses it to list and download what the workflow rendered, and to delete the artifact once it’s placed. -
Push. On each push to
mainthat touchespaper.ymlor a markdown file, the workflow renders what’s due, and the script puts the PDFs on your device within a minute. It commitsfreehand/paper.jsonand takes sent proofs off the queue.
Optional repo settings: the variable FREEHAND_TIME_ZONE (your time zone, for the date on the pages) and, while Freehand or your fork is private, the secret FREEHAND_TOKEN.
Move a repo between the two
Section titled “Move a repo between the two”Change placed_by in its paper.yml: local to send from your laptop, workflow to hand it back to CI.
A repo whose pages should look their own way
Section titled “A repo whose pages should look their own way”A repo can name its own renderer for copies, proofs or both. Freehand still names, places and records the PDF. See renderers: in the paper.yml reference.