diff options
author | Twenty Panda <twenty-panda@posteo.com> | 2024-07-21 21:05:08 +0200 |
---|---|---|
committer | Earl Warren <contact@earl-warren.org> | 2024-07-23 09:27:43 +0200 |
commit | 5c734d8885eca619e7e7bcff63833fc808913c25 (patch) | |
tree | 9c99de7a66df0e05c40aed19d9a928db619404c4 /release-notes-assistant.sh | |
parent | Merge pull request 'English improvements' (#4599) from 0ko/forgejo:i18n-engli... (diff) | |
download | forgejo-5c734d8885eca619e7e7bcff63833fc808913c25.tar.xz forgejo-5c734d8885eca619e7e7bcff63833fc808913c25.zip |
tests: update the PR description with the release notes draft
If the 'worth a release-note' label is set, add a release note entry
to the description of the pull request as a preview.
* use the `release-notes/<pr-number>.md` file if any
* otherwise use the pull request title
Refs: https://code.forgejo.org/forgejo/release-notes-assistant
Diffstat (limited to 'release-notes-assistant.sh')
-rwxr-xr-x | release-notes-assistant.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/release-notes-assistant.sh b/release-notes-assistant.sh new file mode 100755 index 0000000000..4e15975340 --- /dev/null +++ b/release-notes-assistant.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# Copyright twenty-panda <twenty-panda@posteo.com> +# SPDX-License-Identifier: MIT + +payload=$(mktemp) +pr=$(mktemp) +trap "rm $payload $pr" EXIT + +cat >$payload +# +# If this is a backport, refer to the original PR to figure +# out the classification. +# +if $(jq --raw-output .IsBackportedFrom <$payload); then + jq --raw-output '.BackportedFrom[0]' <$payload >$pr +else + jq --raw-output '.Pr' <$payload >$pr +fi + +labels=$(jq --raw-output '.labels[].name' <$pr) + +# +# Was this PR labeled `worth a release note`? +# +if echo "$labels" | grep --quiet worth; then + worth=true +else + worth=false +fi + +# +# If there was no release-notes/N.md file and it is not +# worth a release note, just forget about it. +# +if test -z "$(jq --raw-output .Draft <$payload)"; then + if ! $worth; then + echo -n ZA Included for completness but not worth a release note + exit 0 + fi +fi + +case "$labels" in +*bug*) + if $(jq --raw-output .IsBackportedTo <$payload); then + # + # if it has been backported, it was in the release notes of an older stable release + # and does not need to be in this more recent release notes + # + echo -n ZB Already announced in the release notes of an older stable release + exit 0 + fi + ;; +esac + +case "$labels" in +*breaking*) + case "$labels" in + *feature*) echo -n AA Breaking features ;; + *bug*) echo -n AB Breaking bug fixes ;; + *) echo -n ZC Breaking changes without a feature or bug label ;; + esac + ;; +*forgejo/ui*) + case "$labels" in + *feature*) echo -n BA User Interface features ;; + *bug*) echo -n BB User Interface bug fixes ;; + *) echo -n ZD User Interface changes without a feature or bug label ;; + esac + ;; +*feature*) echo -n CA Features ;; +*bug*) echo -n CB Bug fixes ;; +*) echo -n ZE Other changes without a feature or bug label ;; +esac |