Download a single file from a GitHub repository
download_gh_file.RdLooks up a file by path in the GitHub Contents API and downloads it to a local destination using `curl`. A Bearer token is attached automatically when a GitHub PAT is configured (needed for private repositories).
Usage
download_gh_file(
path,
dest = path,
owner = "ofceweb",
repo = "webblog",
ref = "site-deploy"
)Arguments
- path
Path to the file inside the repository (e.g. `"posts/2024-01-01/index.qmd"`).
- dest
Local path to write the file to. Defaults to `path`.
- owner
GitHub user or organisation name. Defaults to `"ofceweb"`.
- repo
Repository name. Defaults to `"webblog"`.
- ref
Git ref (branch, tag, or SHA). Defaults to `"site-deploy"`.