build-configs(update)

This commit is contained in:
Oliver Davies 2023-08-27 00:04:22 +01:00
parent 771d5200d4
commit e1d4b1cf7a

View file

@ -9,7 +9,7 @@
# the commit message.
#
# This also works with multiple issue IDs in the same string, e.g.
# "OD-123 OD-456".
# "OD-123 OD-456", or IDs on multiple lines.
set -euo pipefail
@ -17,9 +17,9 @@ PROJECT_DIR=$(git rev-parse --show-toplevel) # Get the root directory of the rep
ISSUE_FILE="$PROJECT_DIR/.issue-id"
if [ -f "${ISSUE_FILE}" ]; then
ISSUE_ID=$(cat "${ISSUE_FILE}" | sed 's/ /, /g')
ISSUE_IDS=$(cat "${ISSUE_FILE}" | tr '\n' ',' | tr ' ' ',' | sed 's/,$//' | sed 's/,/, /g')
if [ -n "${ISSUE_ID}" ]; then
sed -i.bak "s/# Refs:/Refs: $ISSUE_ID/" "$1"
if [ -n "${ISSUE_IDS}" ]; then
sed -i.bak "s/# Refs:/Refs: $ISSUE_IDS/" "$1"
fi
fi