Skip to content
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
8 changes: 5 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ci:

repos:
- repo: https://github.com/gitleaks/gitleaks
rev: v8.28.0
rev: v8.30.0
hooks:
- id: gitleaks

Expand All @@ -15,16 +15,18 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-merge-conflict
args: [--assume-in-merge]

- repo: https://github.com/commitizen-tools/commitizen
rev: v4.9.1
rev: v4.10.0
hooks:
- id: commitizen

# Use the mirror since the main `typos` repo has tags for different
# sub-packages, which confuses pre-commit when it tries to find the latest
# version
- repo: https://github.com/adhtruong/mirrors-typos
rev: v1.38.1
rev: v1.40.0
hooks:
- id: typos
5 changes: 1 addition & 4 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ extend-exclude = [
"*.css",
".quarto/*",
"_site/*",
"_book/*",
"*.svg"
]

[default.extend-words]
TRE = "TRE" # trusted research environment
SME = "SME" # small and medium-sized enterprises
44 changes: 39 additions & 5 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
@_default:
just --list --unsorted

# Run all necessary build commands.
run-all: check-spelling check-commits build-website
@_checks: check-spelling check-commits
@_builds: build-contributors build-readme build-website

# Run all necessary build commands
run-all: update-quarto-theme _checks _builds

# List all TODO items in the repository
list-todos:
grep -R -n \
--exclude="*.code-snippets" \
--exclude-dir=.quarto \
--exclude=justfile \
--exclude=_site \
"TODO" *

# Update the Quarto seedcase-theme extension
update-quarto-theme:
# # Add theme if it doesn't exist, update if it does
quarto update seedcase-project/seedcase-theme --no-prompt

# Install the pre-commit hooks
install-precommit:
Expand All @@ -17,18 +34,35 @@ install-precommit:
check-spelling:
uvx typos

# Run checks on commits with non-main branches
# Check the commit messages on the current branch that are not on the main branch
check-commits:
#!/bin/zsh
#!/usr/bin/env bash
branch_name=$(git rev-parse --abbrev-ref HEAD)
number_of_commits=$(git rev-list --count HEAD ^main)
if [[ ${branch_name} != "main" && ${number_of_commits} -gt 0 ]]
then
# If issue happens, try `uv tool update-shell`
uvx --from commitizen cz check --rev-range main..HEAD
else
echo "Can't either be on ${branch_name} or have more than ${number_of_commits}."
echo "On 'main' or current branch doesn't have any commits."
fi

# Build the website using Quarto
build-website:
quarto render

# Re-build the README file from the Quarto version
build-readme:
uvx --from quarto quarto render README.qmd --to gfm

# Generate a Quarto include file with the contributors
build-contributors:
sh ./tools/get-contributors.sh seedcase-project/guidebook > includes/_contributors.qmd

# Check for and apply updates from the template
update-from-template:
uvx copier update --trust --defaults

# Reset repo changes to match the template
reset-from-template:
uvx copier recopy --trust --defaults