mirror of
https://github.com/prometheus/prometheus.git
synced 2025-09-21 13:51:00 +02:00
* feat: add a way to add release notes from the PR make the release note block part of .github/PULL_REQUEST_TEMPLATE.md (inspired from k8s') A CI check would check the input. Signed-off-by: machine424 <ayoubmrini424@gmail.com> * imp Signed-off-by: machine424 <ayoubmrini424@gmail.com> * suggestions Signed-off-by: machine424 <ayoubmrini424@gmail.com> --------- Signed-off-by: machine424 <ayoubmrini424@gmail.com>
31 lines
898 B
Bash
Executable File
31 lines
898 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -u -o pipefail
|
|
|
|
echo "Checking the release-notes block in the PR description"
|
|
|
|
content=$(cat | tr -d '\r' | sed -n '/```release-notes/,/```/p' | grep -v '```' | grep -v '^[[:space:]]*$')
|
|
|
|
if [[ -z "$content" ]]; then
|
|
echo "Error: release-notes block empty or not found, see template at https://github.com/prometheus/prometheus/blob/main/.github/PULL_REQUEST_TEMPLATE.md?plain=1"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "$content" == "NONE" ]]; then
|
|
echo "Release note check passed, content is NONE"
|
|
exit 0
|
|
fi
|
|
|
|
prefixes='FEATURE|ENHANCEMENT|PERF|BUGFIX|SECURITY|CHANGE'
|
|
|
|
while IFS= read -r line; do
|
|
if [[ ! $line =~ ^\[($prefixes)\] ]]; then
|
|
echo "Error: Invalid prefix in '$line'"
|
|
# Convert pipes to brackets
|
|
echo "Content should be NONE or entries should start with one of: [${prefixes//|/] [}]"
|
|
exit 1
|
|
fi
|
|
done <<<"$content"
|
|
|
|
echo "Release note check passed"
|