1
0
mirror of https://github.com/msberends/AMR.git synced 2025-07-11 17:02:00 +02:00

rename pre-commit hook to pre-commit checks (no-check)

This commit is contained in:
2024-04-23 10:55:48 +02:00
parent 04df6dfcf5
commit 0d8a91db49
10 changed files with 21 additions and 19 deletions

View File

@ -29,22 +29,24 @@
# how to conduct AMR data analysis: https://msberends.github.io/AMR/ #
# ==================================================================== #
#!/bin/bash
########################################
# This script runs before every commit #
########################################
echo "Running commit-msg hook..."
# check if the commit message contains '(no-check)' or '(no-verify)'
# check the commit message
COMMIT_MSG=$(cat "$1")
if [[ "$COMMIT_MSG" =~ \(no-check\)|\(no-verify\) ]]; then
echo "Commit check bypassed by commit message."
if [[ "$COMMIT_MSG" =~ \(no-check\)|\(no-checks\)|\(no-verify\) ]]; then
echo "Not running pre-commit checks; commit message contains '(no-check)', '(no-checks)', or '(no-verify)."
exit 0
fi
echo "Running pre-commit checks..."
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if command -v Rscript > /dev/null; then
if [ "$(Rscript -e 'cat(all(c('"'pkgload'"', '"'devtools'"', '"'dplyr'"') %in% rownames(installed.packages())))')" = "TRUE" ]; then
Rscript -e "source('data-raw/_pre_commit_hook.R')"
Rscript -e "source('data-raw/_pre_commit_checks.R')"
currentpkg=$(Rscript -e "cat(pkgload::pkg_name())")
echo "- Adding changed files in ./data-raw and ./man to this commit"
git add data-raw/*

View File

@ -58,9 +58,9 @@ jobs:
- {os: ubuntu-latest, r: 'devel', allowfail: false}
# current 'release' version, check all major OSes:
- {os: macOS-latest, r: '4.3', allowfail: false}
- {os: windows-latest, r: '4.3', allowfail: false}
- {os: ubuntu-latest, r: '4.3', allowfail: false}
- {os: macOS-latest, r: 'release', allowfail: false}
- {os: windows-latest, r: 'release', allowfail: false}
- {os: ubuntu-latest, r: 'release', allowfail: false}
# older versions (see also check-old.yaml for even older versions):
- {os: ubuntu-latest, r: '4.2', allowfail: false}