Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reformat mentions to reduce spamming of mentioned developers #31

Merged
merged 1 commit into from
Jul 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion niv-updater
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ formatIssueLinksNoBackreferences() {
sed "s~#\([0-9]\+\)~[$dep_owner/$dep_repo\xe2\x81\xa0#\1](http://r.duckduckgo.com/l/?uddg=https://github.com/$dep_owner/$dep_repo/issues/\1)~g"
}

# This function formats mentions in the generated changelog in such a way that
# GitHub doesn't ping the mentioned person. This is to remove the noise we might
# throw at our fellow developers.
# Similarly to formatIssueLinksNoBackreferences, we add UNICODE WORD JOINER
# between the '@' and the username
formatMentions() {
sed "s~\B@\([a-zA-Z0-9]\)~@\xe2\x81\xa0\1~g"
}

# A dispatcher for formatIssueLinksPlain and formatIssueLinksNoBackreferences, based on config.
formatIssueLinks() {
if [[ $INPUT_GITHUB_CHANGELOG_NO_BACKREFERENCES == "true" ]]; then
Expand Down Expand Up @@ -308,7 +317,8 @@ createPullRequestsOnUpdate() {
{
hub api "/repos/$dep_owner/$dep_repo/compare/${revision}...${new_revision}" || true
} | jq -r '.commits[] '"$merges_filter"' | "* [`\(.sha[0:8])`](\(.html_url)) \(.commit.message | split("\n") | first)"' \
| formatIssueLinks "$dep_owner" "$dep_repo"
| formatIssueLinks "$dep_owner" "$dep_repo" \
| formatMentions
} >>"$message"
fi

Expand Down