Skip to content

Conversation

@Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Nov 4, 2022

Migrate to Yarn v3 following the steps taken in the module template.

Migrate to Yarn v3 following the steps taken in the module template.
@Gudahtt Gudahtt marked this pull request as ready for review November 4, 2022 13:23
@Gudahtt Gudahtt requested a review from a team as a code owner November 4, 2022 13:23
@Gudahtt Gudahtt merged commit 9b92825 into main Nov 4, 2022
@Gudahtt Gudahtt deleted the migrate-to-yarn-3 branch November 4, 2022 13:56
Qbandev added a commit that referenced this pull request Nov 25, 2025
…254)

## Summary

Implements duplicate detection for changelog entries to prevent
re-adding the same commits across multiple workflow runs.

## Problem

The auto-changelog tool was creating duplicate entries when CI ran
multiple times on a release branch. The existing deduplication only
tracked PR numbers, so direct commits (without PR numbers) like "Update
Attributions" or "chore: bump version" would be added repeatedly.

## Solution

### 1. Dual-Tracking Duplicate Detection
- **PR-based commits**: Check if PR number already exists in changelog
- **Direct commits**: Check if exact description text already exists in
changelog

### 2. Handle Squash Merge Duplicates
Squash merges create two commits with the same content:
- Feature branch commit: `feat: Add feature` (no PR number)
- Merge commit: `feat: Add feature (#123)` (has PR number)

The feature branch commit is now skipped when its corresponding merge
commit exists.

### 3. Fix Merge Commit Categorization
Regular merge commits (format: `Merge pull request #123 from branch`)
were being excluded because categorization used the merge subject
instead of the actual PR content. Now uses the extracted description
from the commit body for proper categorization.

## Changes

- Added `loggedDescriptions` parameter to track all changelog entry
descriptions
- Updated duplicate detection to check both PR numbers and descriptions
- Pre-build Set of PR descriptions for O(1) lookup performance
- Refined exclusion keyword `'merge'` → `'Merge pull request'` to avoid
false exclusions
- Use description for categorizing merge commits instead of subject

## Testing

Verified with test repository
[`consensys-test/metamask-extension-test`](https://github.com/consensys-test/metamask-extension-test)
using multiple release branches with:
- Regular merge PRs
- Squash merge PRs  
- Direct commits (feat, fix, docs, chore)
- Multiple workflow runs to test idempotency

**Results:** ✅ No duplicates, all commits correctly categorized, merge
commits properly handled
- [Latest job
run](https://github.com/consensys-test/metamask-extension-test/actions/runs/19496632321/job/55800299530)
-
[Changelog](https://github.com/consensys-test/metamask-extension-test/blob/release/13.10.0-Changelog/CHANGELOG.md)

## Related

Fixes INFRA-3081


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Add robust duplicate detection using PR numbers and exact descriptions
(incl. squash/merge cases), update exclusions, and add comprehensive
tests.
> 
> - **Changelog generation (`src/get-new-changes.ts`)**:
> - Add `loggedDescriptions` support and dedup logic for PR-based and
direct commits, skipping direct commits when a matching PR merge exists.
> - Use description (not subject) for merge-commit categorization;
append PR link with optional short format.
> - Replace assertion with explicit error when `git show` subject is
empty; refine GITHUB_TOKEN retrieval.
> - **Changelog update (`src/update-changelog.ts`)**:
> - Extract trimmed `loggedDescriptions` from existing changelog and
pass to `getNewChangeEntries`.
> - **Exclusions (`src/constants.ts`)**:
>   - Adjust exclusion keyword from `merge` to `Merge pull request`.
> - **Tests**:
> - Add `src/get-new-changes.test.ts` with cases for PR vs direct
commits, duplicate detection across runs, squash/merge handling, link
formatting, and edge cases.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
d4fea63. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants