Skip to content

Commit

Permalink
Merge pull request #4227 from cloudfoundry/changelog
Browse files Browse the repository at this point in the history
Update changelog tool to also show changes for fork
  • Loading branch information
richard-cox authored Apr 15, 2020
2 parents c6df2d4 + 0176a86 commit e4ab9a9
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions build/tools/changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,21 @@ echo ""

# Get the version number from the package.json file

# This is the base repository
REPO=${1:-cloudfoundry/stratos}
FORK=""

# Check if this is a fork
REPO_URL=$(git config --get remote.origin.url)
REGEX="(https:\/\/|git@)github.com[\/:]([a-z0-9A-Z]*)\/([a-z0-9A-Z\-]*)"
if [[ $REPO_URL =~ $REGEX ]]; then
FORK=${BASH_REMATCH[2]}/${BASH_REMATCH[3]}
if [ "$FORK" == "$REPO" ]; then
FORK=""
else
echo -e "GitHub repository: ${CYAN}${BOLD}$FORK${RESET}"
fi
fi

MILESTONE=$(cat "${STRATOS_DIR}/package.json" | jq -r .version)
echo -e "${YELLOW}Current version : ${BOLD}${MILESTONE}${RESET}"
Expand All @@ -42,18 +56,24 @@ fi
echo -e "${YELLOW}Previous version : ${BOLD}$CURRENT${RESET}"

function search() {
QUERY=$1
curl -s "https://api.github.com/search/issues?q=${QUERY}" | jq -r '.items | .[] | "- \(.title) [\\#\(.number)](\(.html_url))"' | tee -a ${CHANGELOG}
FILTER=$1
if [ -n "${FORK_QUERY}" ]; then
curl -s "https://api.github.com/search/issues?q=${FORK_QUERY}${FILTER}" | jq -r '.items | .[] | "- \(.title) [\\#\(.number)](\(.html_url))"' | tee -a ${CHANGELOG}
fi
curl -s "https://api.github.com/search/issues?q=${QUERY}${FILTER}" | jq -r '.items | .[] | "- \(.title) [\\#\(.number)](\(.html_url))"' | tee -a ${CHANGELOG}
}

function log() {
echo $1 | tee -a ${CHANGELOG}
}

QUERY="repo:${REPO}+milestone:3.1.0+state:closed"
if [ -n "${FORK}" ]; then
FORK_QUERY="repo:${FORK}+milestone:3.1.0+state:closed"
fi

BUGS="$QUERY+label:bug"
NON_BUGS="$QUERY+-label:bug"
BUGS="+label:bug"
NON_BUGS="+-label:bug"

mv ${CHANGELOG} CHANGELOG.old

Expand Down

0 comments on commit e4ab9a9

Please sign in to comment.