-#!/bin/bash -x
+#!/bin/bash -l
# SPDX-License-Identifier: EPL-1.0
##############################################################################
# Copyright (c) 2017 The Linux Foundation and others.
# This script generates Service Release notes and appends them to the release
# notes in the docs project and submits a patch.
-RELEASE=${RELEASE:-$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep generate-release-notes | awk '{print $2}')}
+set -x
+
+# shellcheck disable=SC1090
+. ~/lf-env.sh
+
+lf-activate-venv "git-review==1.28"
+
+RELEASE=${RELEASE:-$(echo "$GERRIT_EVENT_COMMENT_TEXT" | base64 -d | grep generate-release-notes | awk '{print $2}')}
if [ -z "$RELEASE" ]; then
echo "ERROR: The RELEASE variable is not set."
exit 1
git clone -b "$GERRIT_BRANCH" https://git.opendaylight.org/gerrit/docs.git "$DOCS_DIR"
cd "$DOCS_DIR" || exit 1
cp "$WORKSPACE/release-notes.rst" "docs/release-notes/release-notes-${RELEASE,,}.rst"
+sed -i -e '$a release-notes-'"${RELEASE,,}"'' "docs/release-notes/index.rst"
git add docs/release-notes/
-GERRIT_COMMIT_MESSAGE="Update release notes"
+GERRIT_COMMIT_MESSAGE="Update release notes for $RELEASE"
GERRIT_TOPIC="autogenerate-release-notes"
CHANGE_ID=$(ssh -p 29418 "jenkins-$SILO@git.opendaylight.org" gerrit query \
limit:1 owner:self is:open project:docs \