From 4ee77e9dcdc44fd534166bf8b6f501c008b9f6bf Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Thu, 16 Feb 2017 14:03:59 -0500 Subject: [PATCH] reduce meaningless changes when updating release notes links If the existing link matches the expected link, leave it in place regardless of where it is in the file. If the link needs to be updated, try to insert the link after the "team" entry, assuming that will be closer to the top of the file than "releases" and avoiding the need to figure out if "branches" comes before or after "releases". Change-Id: I4161bb048deba91ccf8170ea5f0b7208bd9a80a3 Signed-off-by: Doug Hellmann --- tools/add_release_note_links.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/tools/add_release_note_links.sh b/tools/add_release_note_links.sh index 92edb7f2a2..48c9194825 100755 --- a/tools/add_release_note_links.sh +++ b/tools/add_release_note_links.sh @@ -42,12 +42,17 @@ for filename in deliverables/$SERIES/*.yaml; do if ! url_exists $url; then echo " no release notes page at $url" else - # Remove any existing links, since they might point to the - # "unreleased" page. - sed -i -e '/release-notes/d' $filename - # Add the link pointing to the series-specific page. - sed -i -e "/releases:/i \ -release-notes: $url" $filename - echo + new_value="release-notes: $url" + if grep -q "$new_value" $filename; then + echo " OK" + else + # Remove any existing links, since they might point to the + # "unreleased" page. + sed -i -e '/release-notes/d' $filename + # Add the link pointing to the series-specific page. + sed -i -e "/team:.*/a \ +$new_value" $filename + echo " updated" + fi fi done