diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index cf90177b1d..ec4eef8dae 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,9 +1,5 @@ + +#### Which issue(s) does the PR fix: + + +#### Does this PR introduce a user-facing change? + +```release-notes + +``` diff --git a/.github/workflows/check_release_notes.yml b/.github/workflows/check_release_notes.yml new file mode 100644 index 0000000000..5b191c804a --- /dev/null +++ b/.github/workflows/check_release_notes.yml @@ -0,0 +1,23 @@ +name: 'Check release notes' +on: + pull_request: + types: + - opened + - reopened + - edited + - synchronize +permissions: + contents: read + pull-requests: read + +jobs: + check_release_notes: + name: check + runs-on: ubuntu-latest + if: github.repository_owner == 'prometheus' || github.repository_owner == 'prometheus-community' # Don't run this workflow on forks. + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - env: + PR_DESCRIPTION: ${{ github.event.pull_request.body }} + run: | + echo "$PR_DESCRIPTION" | ./scripts/check_release_notes.sh diff --git a/RELEASE.md b/RELEASE.md index 95d11737d9..c30105deff 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -108,7 +108,7 @@ Changes for a patch release or release candidate should be merged into the previ Bump the version in the `VERSION` file and update `CHANGELOG.md`. Do this in a proper PR pointing to the release branch as this gives others the opportunity to chime in on the release in general and on the addition to the changelog in particular. For a release candidate, append something like `-rc.0` to the version (with the corresponding changes to the tag name, the release name etc.). -When updating the `CHANGELOG.md` look at all PRs included in the release since the last release and verify if they need a changelog entry. +When updating the `CHANGELOG.md` look at all PRs included in the release since the last release and verify if they need a changelog entry. Most PRs will have their changelog entries specified in the `release-notes` blocks within their PR descriptions. Note that `CHANGELOG.md` should only document changes relevant to users of Prometheus, including external API changes, performance improvements, and new features. Do not document changes of internal interfaces, code refactorings and clean-ups, changes to the build process, etc. People interested in these are asked to refer to the git history. @@ -120,6 +120,7 @@ Entries in the `CHANGELOG.md` are meant to be in this order: * `[CHANGE]` * `[FEATURE]` * `[ENHANCEMENT]` +* `[PERF]` * `[BUGFIX]` Then bump the UI module version: diff --git a/scripts/check_release_notes.sh b/scripts/check_release_notes.sh new file mode 100755 index 0000000000..430d863056 --- /dev/null +++ b/scripts/check_release_notes.sh @@ -0,0 +1,30 @@ +#!/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"