-
Notifications
You must be signed in to change notification settings - Fork 9
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
Improved version of source_changelog #541
Open
j-rivero
wants to merge
7
commits into
master
Choose a base branch
from
improve_changelog
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8c71ffc
New version of source_changelog
j-rivero c60d796
Make the script to be able to display external contributions
j-rivero b78b9a9
Do not display openrobotics but external contributors
j-rivero 0d7055f
Handle git@ style of remotes
j-rivero aa72488
Exclude @osrfoundation.org emails and @noreply.github.com
j-rivero 89e9a0a
Merge branch 'master' into improve_changelog
scpeters d577f2a
Modify the script to use current git log approach
j-rivero File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,57 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
PREV_TAG=$1 | ||
current_origin_remote=$(git config --get remote.origin.url) | ||
|
||
git fetch --tags | ||
# need tweaks if using ssh | ||
if [[ "${current_origin_remote/git@}" != "${current_origin_remote}" ]]; then | ||
current_origin_remote=${current_origin_remote/\.git} | ||
current_origin_remote=${current_origin_remote/[email protected]:/https://github.com/} | ||
fi | ||
|
||
REPO=$(basename `git rev-parse --show-toplevel`) | ||
REPO_FULL="${REPO/ign-/ignition-}" | ||
MAJOR=${PREV_TAG%.*.*} | ||
BRANCH=${REPO/sdformat/sdf}${MAJOR} | ||
if [[ -z ${current_origin_remote} ]]; then | ||
echo "Script is unable to detect current remote.origin.url in this directory" | ||
exit 1 | ||
fi | ||
|
||
COMMITS=$(git log ${BRANCH}...${REPO_FULL}${MAJOR}_${PREV_TAG} --pretty=format:"%h") | ||
if [[ $(git branch --show-current) == 'main' ]]; then | ||
echo "Error: main branch should not be used for releasing" | ||
exit 1 | ||
fi | ||
|
||
for COMMIT in $COMMITS | ||
do | ||
TITLE_FULL=$(git log --format="%s" -n 1 $COMMIT) | ||
TITLE=${TITLE_FULL% (\#*)} | ||
PR=${TITLE_FULL#*\#} | ||
PR=${PR%)} | ||
if [[ -f "Changelog.md" ]]; then | ||
software_name=$(head -1 Changelog*) | ||
printf "%s (%s)\n\n" "${software_name}" "$(date +%Y-%m-%d)" | ||
fi | ||
|
||
echo "1. $TITLE" | ||
echo " * [Pull request #$PR](https://github.com/ignitionrobotics/$REPO/pull/$PR)" | ||
echo "" | ||
current_tag=$(git symbolic-ref HEAD) | ||
start_ref="HEAD" | ||
|
||
# Find the previous release on the same branch, skipping prereleases if the | ||
# current tag is a full release | ||
previous_tag="" | ||
while [[ -z $previous_tag || ( $previous_tag == *-* && $current_tag != *-* ) ]]; do | ||
previous_tag="$(git describe --tags "$start_ref"^ --abbrev=0)" | ||
start_ref="$previous_tag" | ||
done | ||
|
||
REPO=$(basename `git rev-parse --show-toplevel`) | ||
REPO_FULL="${REPO/ign-/ignition-}" | ||
VERSION=${previous_tag/${REPO_FULL}*_} | ||
MAJOR=${VERSION%.*.*} | ||
BRANCH=${REPO/sdformat/sdf}${MAJOR} | ||
|
||
git log "${BRANCH}"..."${previous_tag}" --pretty=format:"%h|%s|%ae|%an" | \ | ||
while IFS='|' read -r sha title author_email author || [[ -n ${sha} ]]; do | ||
pr_num="$(grep -o '#[[:digit:]]\+' <<<"$title")" | ||
pr_num="${pr_num:1}" | ||
pr_desc=${title/\ (#[[:digit:]]*)} | ||
printf "1. %s\n" "$pr_desc" | ||
printf " * [Pull request #%s](%s/pull/%s)\n" "$pr_num" "$current_origin_remote" "$pr_num" | ||
if [[ "${author_email/@openrobotics.org}" == "${author_email}" ]] && \ | ||
[[ "${author_email/@osrfoundation.org}" == "${author_email}" ]] && \ | ||
[[ "${author_email/@users.noreply.github.com}" == "${author_email}" ]]; then | ||
printf " * A contribution from: %s <%s>\n" "$author" "$author_email" | ||
fi | ||
echo | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about excluding us, we need love too ❤️