mirror of
https://git.proxmox.com/git/pve-eslint
synced 2025-10-04 10:28:39 +00:00

set -u aborts if we access any undefined variable, which $1 can be if no argument got passed.. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
37 lines
748 B
Bash
Executable File
37 lines
748 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
arg="${1:-}"
|
|
if [[ $arg =~ ^-(h|-help)$ ]]; then
|
|
echo "usage: $0 [<FROM-VERSION>]"
|
|
echo ""
|
|
echo "Filter out irrelevant entries (sponsors, chore, docs) from the upstream changelog."
|
|
exit 0
|
|
fi
|
|
|
|
repo="$(git rev-parse --show-toplevel)"
|
|
|
|
cfn="$repo/changes.new.tmp"
|
|
|
|
cp "$repo/eslint/CHANGELOG.md" "$cfn"
|
|
|
|
sed -ri 's/^\* \S+ /+ /g' "$cfn"
|
|
|
|
sed -i '/ Sponsors: /Id' "$cfn"
|
|
sed -i '/ Chore: /Id' "$cfn"
|
|
sed -i '/ Docs: /Id' "$cfn"
|
|
sed -i '/ ci: /Id' "$cfn"
|
|
sed -i '/ build: /Id' "$cfn"
|
|
sed -i '/ESLint Jenkins/Id' "$cfn"
|
|
|
|
if [[ $arg ]]; then
|
|
version="$arg"
|
|
sed -i "/^$version -/Q" "$cfn"
|
|
sed -i '/^\+ /!d' "$cfn"
|
|
fi
|
|
|
|
mv "$cfn" "$repo/changes"
|
|
|
|
echo "trimmed changes available at '$repo/changes'"
|