From d9ee5e1d1c73dd9974682c54e38695049c028317 Mon Sep 17 00:00:00 2001 From: Ron <45816308+rjaegers@users.noreply.github.com> Date: Mon, 1 Jul 2024 09:53:52 +0100 Subject: [PATCH] ci: prevent GitHub backlink creation on extension updates (#479) ci: prevent GitHub backlink creation on extension udpates --- .../update-vscode-extensions/update-vscode-extensions.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/actions/update-vscode-extensions/update-vscode-extensions.sh b/.github/actions/update-vscode-extensions/update-vscode-extensions.sh index 6ce2809..bba0bd3 100755 --- a/.github/actions/update-vscode-extensions/update-vscode-extensions.sh +++ b/.github/actions/update-vscode-extensions/update-vscode-extensions.sh @@ -8,6 +8,12 @@ EXTENSIONS= UPDATE_DETAILS_MARKDOWN= UPDATED_EXTENSIONS_JSON="[]" +prevent_github_backlinks() { + # Prevent GitHub from creating backlinks to issues by replacing the URL with a non-redirecting one + # See: https://github.com/orgs/community/discussions/23123#discussioncomment-3239240 + sed 's|https://github.com|https://www.github.com|g' +} + get_github_releasenotes() { local GITHUB_URL=${1:?} local CURRENT_RELEASE=${2:?} @@ -37,7 +43,7 @@ for EXTENSION in $(echo $JSON | jq -r '.customizations.vscode.extensions | flatt then GITHUB_URL=$(echo $LATEST_NON_PRERELEASE_VERSION_JSON | jq -r '.properties | map(select(.key == "Microsoft.VisualStudio.Services.Links.GitHub"))[] | .value') - RELEASE_DETAILS=$(get_github_releasenotes $GITHUB_URL $CURRENT_VERSION) + RELEASE_DETAILS=$(get_github_releasenotes $GITHUB_URL $CURRENT_VERSION | prevent_github_backlinks) UPDATE_DETAILS_MARKDOWN=$(printf "Updates \`%s\` from %s to %s\n
\nRelease notes\n
\n\n%s\n
\n
\n\n%s" $NAME $CURRENT_VERSION $LATEST_NON_PRERELEASE_VERSION "$RELEASE_DETAILS" "$UPDATE_DETAILS_MARKDOWN") UPDATED_EXTENSIONS_JSON=$(echo $UPDATED_EXTENSIONS_JSON | jq -c '. += ["'$NAME'"]') fi