Skip to content

Commit

Permalink
Merge pull request #35 from JarvusInnovations/releases/github-actions…
Browse files Browse the repository at this point in the history
…/release-prepare/r4

fix(github-actions/release-prepare): fix placeholder and improve log output
  • Loading branch information
themightychris authored Nov 18, 2023
2 parents 908857b + 3d2127e commit f7bfab0
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions github-actions/release-prepare/pull-request.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@


# get latest release tag
echo "Looking for last tag..."
latest_release=$(git describe --tags --abbrev=0 "origin/${RELEASE_BRANCH}")


# generate next patch release tag
if [ -n "${latest_release}" ]; then
echo "Found tag: ${latest_release}"
latest_release_bumped=$(echo "${latest_release}" | awk -F. -v OFS=. '{$NF++;print}')
else
echo "No tag found, defaulting to v0.1.0"
latest_release_bumped='v0.1.0'
fi

# create or update PR

# prepare PR text
pr_title="Release: ${latest_release_bumped}"
pr_body="$(cat <<EOF
## Improvements
Expand All @@ -22,13 +26,16 @@ pr_body="$(cat <<EOF
EOF
)"

pr_number=$(gh pr view "helm-chart" --json number --jq '.number')

# create or update PR
echo "Looking for existing PR..."
pr_number=$(gh pr view "${GITHUB_REF_NAME}" --json number --jq '.number')

if [ -n "${pr_number}" ]; then
echo "Updating PR #${pr_number}"
echo "Found existing PR #${pr_number}, looking for existing comment..."
existing_comment_id=$(gh api "/repos/${GITHUB_REPOSITORY}/issues/${pr_number}/comments" --jq '.[] | select(.body | startswith("## Changelog\n\n")) | .id')
else
echo "Opening PR"
echo "Opening PR..."
pr_url=$(gh pr create \
--base "${RELEASE_BRANCH}" \
--head "${GITHUB_REF_NAME}" \
Expand All @@ -41,6 +48,7 @@ fi


# build changelog
echo "Getting list of commits in range ${RELEASE_BRANCH}..${GITHUB_REF_NAME}..."
commits=$(
git log \
--first-parent \
Expand All @@ -51,6 +59,7 @@ commits=$(

changelog=()

echo "Generating changelog lines..."
while read -r commit; do
subject="$(git show -s --format=%s "${commit}")"
line=""
Expand Down

0 comments on commit f7bfab0

Please sign in to comment.