R3: --body-file <path>/- across body/comment carriers (#1474)
ci/woodpecker/push/publish Pipeline was canceled

Co-authored-by: marcie <[email protected]>
This commit was merged in pull request #1474.
This commit is contained in:
2026-08-29 22:49:20 +00:00
committed by orch-01
parent ba3b854d50
commit ee6c842918
10 changed files with 199 additions and 0 deletions
@@ -10,6 +10,7 @@ source "$SCRIPT_DIR/detect-platform.sh"
# Default values
TITLE=""
BODY=""
BODY_FILE=""
BASE_BRANCH=""
HEAD_BRANCH=""
LABELS=""
@@ -158,6 +159,12 @@ while [[ $# -gt 0 ]]; do
BODY="$2"
shift 2
;;
--body-file)
# R3: body from file (or '-' = stdin); mutually exclusive with --body.
[[ $# -ge 2 && "$2" != --* ]] || usage_error "option $1 requires a path (or - for stdin)"
BODY_FILE="$2"
shift 2
;;
-B|--base)
[[ $# -ge 2 && "$2" != - && "$2" != --* && ! "$2" =~ ^-[[:alnum:]] ]] || usage_error "option $1 requires a value (option-like values are rejected; bare - is reserved)"
BASE_BRANCH="$2"
@@ -197,6 +204,19 @@ while [[ $# -gt 0 ]]; do
esac
done
# R3 (2026-08-29): resolve --body-file into BODY (file or stdin '-');
# exclusive with an explicit --body/--comment value.
if [[ -n "$BODY_FILE" ]]; then
[[ -z "$BODY" ]] || usage_error "--body-file and --body are mutually exclusive"
if [[ "$BODY_FILE" == "-" ]]; then
BODY=$(cat) || usage_error "could not read body from stdin"
else
[[ -r "$BODY_FILE" ]] || usage_error "body file not readable: $BODY_FILE"
BODY=$(cat "$BODY_FILE") || usage_error "could not read body file: $BODY_FILE"
fi
fi
# If no title but issue provided, generate title
if [[ -z "$TITLE" ]] && [[ -n "$ISSUE" ]]; then
TITLE="Fixes #$ISSUE"