Skip to content

Commit

Permalink
ci: prevent GitHub backlink creation on extension updates (#479)
Browse files Browse the repository at this point in the history
ci: prevent GitHub backlink creation on extension udpates
  • Loading branch information
rjaegers committed Jul 1, 2024
1 parent 1ee385d commit d9ee5e1
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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:?}
Expand Down Expand Up @@ -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<details>\n<summary>Release notes</summary>\n<blockquote>\n\n%s\n</blockquote>\n</details>\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
Expand Down

0 comments on commit d9ee5e1

Please sign in to comment.