mirror of
https://github.com/opdavies/build-configs.git
synced 2025-09-06 03:15:34 +01:00
fix(git-hooks): re-add
This commit is contained in:
parent
ef928cbb3a
commit
ad86e066cb
3 changed files with 2 additions and 8 deletions
7
templates/common/.githooks/pre-push.twig
Executable file
7
templates/common/.githooks/pre-push.twig
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# {{ managedText }}
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
just test-commit
|
25
templates/common/.githooks/prepare-commit-msg.twig
Executable file
25
templates/common/.githooks/prepare-commit-msg.twig
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# {{ managedText }}
|
||||
|
||||
# Load the issue ID from an `.issue-id` file within the project and replace the
|
||||
# `ISSUE_ID` placeholder within a Git commit message.
|
||||
#
|
||||
# For example, running `echo "OD-123" > .issue-id` will add `Refs: OD-123` to
|
||||
# the commit message.
|
||||
#
|
||||
# This also works with multiple issue IDs in the same string, e.g.
|
||||
# "OD-123 OD-456", or IDs on multiple lines.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PROJECT_DIR=$(git rev-parse --show-toplevel)
|
||||
ISSUE_FILE="$PROJECT_DIR/.issue-id"
|
||||
|
||||
if [ -f "${ISSUE_FILE}" ]; then
|
||||
ISSUE_IDS=$(cat "${ISSUE_FILE}" | tr '\n' ',' | tr ' ' ',' | sed 's/,$//' | sed 's/,/, /g')
|
||||
|
||||
if [ -n "${ISSUE_IDS}" ]; then
|
||||
sed -i.bak "s/# Refs:/Refs: $ISSUE_IDS/" "$1"
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue