Skip to content

Commit b774173

Browse files
committed
refactor: streamline changelog generation logic
- Consolidate changelog generation for both extension and mobile platforms to use yarn auto-changelog. - Remove redundant merge logic in update-release-changelog.sh to simplify the process. - Ensure consistent handling of the --requirePrNumbers flag across scripts for improved clarity and functionality.
1 parent 7e400a5 commit b774173

File tree

2 files changed

+26
-57
lines changed

2 files changed

+26
-57
lines changed

.github/scripts/create-platform-release-pr.sh

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -350,32 +350,21 @@ create_changelog_pr() {
350350

351351
# Generate Changelog and Test Plan
352352
echo "Generating changelog for ${platform}.."
353-
354-
# Platform-specific logic: extension uses yarn auto-changelog (project dependency),
355-
# mobile uses npx with pinned version
356-
if [[ "${platform}" == "extension" ]]; then
357-
if [[ "${REQUIRE_PR_NUMBERS}" == "true" ]]; then
358-
yarn auto-changelog update --rc \
359-
--repo "${GITHUB_REPOSITORY_URL}" \
360-
--currentVersion "${new_version}" \
361-
--autoCategorize \
362-
--useChangelogEntry \
363-
--useShortPrLink \
364-
--requirePrNumbers
365-
else
366-
yarn auto-changelog update --rc \
367-
--repo "${GITHUB_REPOSITORY_URL}" \
368-
--currentVersion "${new_version}" \
369-
--autoCategorize \
370-
--useChangelogEntry \
371-
--useShortPrLink
372-
fi
353+
if [[ "${REQUIRE_PR_NUMBERS}" == "true" ]]; then
354+
yarn auto-changelog update --rc \
355+
--repo "${GITHUB_REPOSITORY_URL}" \
356+
--currentVersion "${new_version}" \
357+
--autoCategorize \
358+
--useChangelogEntry \
359+
--useShortPrLink \
360+
--requirePrNumbers
373361
else
374-
# Mobile platform: use npx with pinned version, --requirePrNumbers not applicable
375-
npx @metamask/[email protected] update --rc \
362+
yarn auto-changelog update --rc \
376363
--repo "${GITHUB_REPOSITORY_URL}" \
377364
--currentVersion "${new_version}" \
378-
--autoCategorize
365+
--autoCategorize \
366+
--useChangelogEntry \
367+
--useShortPrLink
379368
fi
380369

381370
# Skip commits.csv for hotfix releases (previous_version_ref is literal "null")

.github/scripts/update-release-changelog.sh

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,6 @@ checkout_or_create_branch() {
6363
else
6464
git checkout "${branch_name}"
6565
fi
66-
# Merge the base branch to include any new commits from the release branch.
67-
# This merge logic is intentionally different from checkout_or_create_branch()
68-
# in create-platform-release-pr.sh which creates fresh branches.
69-
# This script runs on every push to the release branch, so the changelog branch
70-
# may already exist with older content. We merge to sync file changes.
71-
if [[ -n "${base_branch}" ]]; then
72-
echo "Merging ${base_branch} into ${branch_name} to include new commits..."
73-
git fetch origin "${base_branch}"
74-
git merge "origin/${base_branch}" --no-edit || {
75-
echo "Merge conflict detected during merge of ${base_branch} into ${branch_name}."
76-
echo "Aborting merge and resetting to pre-merge state to preserve existing changelog content."
77-
git merge --abort
78-
git reset --hard HEAD
79-
echo "Continuing with existing changelog branch state. auto-changelog will regenerate content."
80-
}
81-
fi
8266
else
8367
echo "Creating new branch ${branch_name}"
8468
if [[ -n "${base_branch}" ]]; then
@@ -221,25 +205,21 @@ checkout_or_create_branch "${CHANGELOG_BRANCH}" "${RELEASE_BRANCH}"
221205
echo "Generating changelog for ${PLATFORM} ${VERSION}.."
222206

223207
# Build the auto-changelog command based on platform and options
224-
if [[ "${PLATFORM}" == "extension" ]]; then
225-
if [[ "${REQUIRE_PR_NUMBERS}" == "true" ]]; then
226-
yarn auto-changelog update --rc \
227-
--repo "${GITHUB_REPOSITORY_URL}" \
228-
--currentVersion "${VERSION}" \
229-
--autoCategorize \
230-
--useChangelogEntry \
231-
--useShortPrLink \
232-
--requirePrNumbers
233-
else
234-
yarn auto-changelog update --rc \
235-
--repo "${GITHUB_REPOSITORY_URL}" \
236-
--currentVersion "${VERSION}" \
237-
--autoCategorize \
238-
--useChangelogEntry \
239-
--useShortPrLink
240-
fi
208+
if [[ "${REQUIRE_PR_NUMBERS}" == "true" ]]; then
209+
yarn auto-changelog update --rc \
210+
--repo "${GITHUB_REPOSITORY_URL}" \
211+
--currentVersion "${new_version}" \
212+
--autoCategorize \
213+
--useChangelogEntry \
214+
--useShortPrLink \
215+
--requirePrNumbers
241216
else
242-
npx @metamask/[email protected] update --rc --repo "${GITHUB_REPOSITORY_URL}" --currentVersion "${VERSION}" --autoCategorize
217+
yarn auto-changelog update --rc \
218+
--repo "${GITHUB_REPOSITORY_URL}" \
219+
--currentVersion "${new_version}" \
220+
--autoCategorize \
221+
--useChangelogEntry \
222+
--useShortPrLink
243223
fi
244224

245225
# commits.csv generation removed (no longer required)

0 commit comments

Comments
 (0)