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

fix: changesets release preview #13149

Merged
merged 5 commits into from
May 8, 2024
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
21 changes: 15 additions & 6 deletions tools/ci/format_changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/usr/bin/env bash

# This script will generate the next release using changeset.
# However, since changeset has its own semvar versioning system
# and we have our custom tags, this script rewrites the CHANGELOG.md
# with each tag as its header and group respective changeset that has
# the tag under it.
#
# The workflow is here:
# https://github.com/smartcontractkit/chainlink/actions/workflows/changesets-preview-pr.yml

set -euo pipefail

if [[ -z "${GITHUB_OUTPUT:-}" ]]; then
Expand Down Expand Up @@ -35,7 +44,7 @@ append_changelog_content() {
continue
fi
changesets=$(jq -r --arg key "$tag" '.[$key] | join("\n\n")' tags.json)
read -d '' changelog_content <<EOF
read -d '' changelog_content <<EOF || true
${changelog_content}

## ${tag}
Expand All @@ -49,17 +58,17 @@ set_pr_body() {
# GitHub Issues/PRs messages have a max size limit on the message body payload.
# This is the error: `body is too long (maximum is 65536 characters)`.
max_pr_desc_char_length=65000
read -d '' pr_header <<EOF
read -d '' pr_header <<EOF || true
This PR is a preview of the changes that will be included in the next release. Please do not merge this PR.
---
EOF
if [[ ${#changelog_content} -gt $max_pr_desc_char_length ]]; then
read -d '' pr_body <<EOF
read -d '' pr_body <<EOF || true
${pr_header}
The changelog content is too long for the PR description. Please view the full changelog in the [CHANGELOG.md](https://github.com/smartcontractkit/chainlink/blob/changesets/release-preview/CHANGELOG.md)
EOF
else
read -d '' pr_body <<EOF
read -d '' pr_body <<EOF || true
${pr_header}
${changelog_content}
EOF
Expand All @@ -71,7 +80,7 @@ EOF
}

set_new_changelog_content() {
read -d '' new_changelog <<EOF
read -d '' new_changelog <<EOF || true
${changelog_content}
${current_changelog}
EOF
Expand Down Expand Up @@ -118,7 +127,7 @@ pnpm changeset version
version=$(jq -r '.version' package.json)
echo "version=$version" >> $GITHUB_OUTPUT

read -d '' changelog_content <<EOF
read -d '' changelog_content <<EOF || true
# Changelog Chainlink Core

## ${version} - PREVIEW
Expand Down
Loading