Skip to content
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
18 changes: 9 additions & 9 deletions tools/check_release_notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ get_opts() {
shift 2
;;
--base-sha)
PULL_BASE_SHA="$2"
base_sha="$2"
shift 2
;;
--pr-head-sha)
Expand Down Expand Up @@ -122,24 +122,24 @@ validate_opts() {
exit 1
fi

if [ -z "${PULL_BASE_SHA:-}" ]; then
echo "PULL_BASE_SHA not specified. This must match the base SHA for the pull request."
exit 1
fi

if [ -z "${REPO_PATH:-}" ]; then
echo "REPO_PATH not specified. Using current working directory."
REPO_PATH=$(pwd)
else
echo "Using REPO_PATH ${REPO_PATH}"
fi

if [ -z "${base_sha:-}" ]; then
echo "base-sha not specified. Calculating from the PULL_NUMBER"
base_sha=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/"${REPO_OWNER}"/"${REPO_NAME}"/pulls/"${PULL_NUMBER}"/commits | jq -r '.[0].parents[0].sha')
echo "base_sha: ""${base_sha}"""
fi
}

# Curl the GitHub API to get a list of files for the specified PR. If files are
# found, exit. We might eventually want to validate the data here.
checkForFiles() {
echo "Checking files from pull request ${REPO_OWNER}/${REPO_NAME}#${PULL_NUMBER} head SHA: ${PULL_PULL_SHA} destination branch: ${PULL_BASE_REF}, base SHA: ${PULL_BASE_SHA}"
echo "Checking files from pull request ${REPO_OWNER}/${REPO_NAME}#${PULL_NUMBER} head SHA: ${PULL_PULL_SHA} destination branch: ${PULL_BASE_REF}, base SHA: ${base_sha}"

pushd "${REPO_PATH}"

Expand All @@ -149,7 +149,7 @@ checkForFiles() {
popd

set +e
"${GEN_RELEASE_NOTES_PATH}"/gen-release-notes --oldBranch "${PULL_BASE_SHA}" --newBranch "${PULL_PULL_SHA}" --templates "${GEN_RELEASE_NOTES_PATH}"/templates --notes ./releasenotes/notes --validateOnly
"${GEN_RELEASE_NOTES_PATH}"/gen-release-notes --oldBranch "${base_sha}" --newBranch "${PULL_PULL_SHA}" --templates "${GEN_RELEASE_NOTES_PATH}"/templates --notes ./releasenotes/notes --validateOnly
returnCode=$?
set -e

Expand Down Expand Up @@ -183,7 +183,7 @@ function validateNotes() {
popd

local errorOccurred=0
git diff-tree -r --diff-filter=AMR --name-only --relative=releasenotes/notes "${PULL_BASE_SHA}" "${PULL_PULL_SHA}" | \
git diff-tree -r --diff-filter=AMR --name-only --relative=releasenotes/notes "${base_sha}" "${PULL_PULL_SHA}" | \
{
set +e
while read -r line; do
Expand Down