Skip to content

Conversation

@cwperks
Copy link
Member

@cwperks cwperks commented Jun 9, 2025

Description

This is a quality of life PR to drastically reduce the number of merge conflicts and prevent maintainers from having to constantly resolve conflicts only in the CHANGELOG file.

By setting the gitattribute merge=union, this tells git to automatically take the union of both sides of the conflicts without maintainers having to manually determine how to perform the merge.

Related Issues

Resolves #18475

Related to https://about.gitlab.com/blog/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

…conflicts

Signed-off-by: Craig Perkins <cwperx@amazon.com>
@cwperks cwperks requested a review from a team as a code owner June 9, 2025 15:50
@github-actions github-actions bot added bug Something isn't working Build Build Tasks/Gradle Plugin, groovy scripts, build tools, Javadoc enforcement. labels Jun 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2025

❌ Gradle check result for 9ec0df0: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@prudhvigodithi
Copy link
Member

Thanks @cwperks this really helps, just curious to see the behavior do you have sample PR from fork repo?

@cwperks
Copy link
Member Author

cwperks commented Jun 9, 2025

@prudhvigodithi I do not, but I could merge this into security repo first and demonstrate it working.

Essentially, by specifying CHANGELOG.md merge=union its telling git that if there are merge conflicts then take the union from both sides. Since the sides on the left and the right are mutually exclusively and should both be included, union makes sense for this file.

@rishabhmaurya
Copy link
Contributor

rishabhmaurya commented Jun 9, 2025

@cwperks Indeed, this will make life so much better. Is it a possibility to avoid gradle checks when changes are made to this file? as this coupling makes it even worse.

@cwperks
Copy link
Member Author

cwperks commented Jun 9, 2025

@cwperks Indeed, this will make life so much better. Is it a possibility to avoid gradle checks when changes are made to this file? as this coupling makes it even worse.

@rishabhmaurya It is possible, but I haven't scoped out what would be required for that. On the k-NN repo they use paths: on the GHA trigger like this: https://github.com/opensearch-project/k-NN/blob/main/.github/workflows/test_security.yml#L9-L17

If the PR contains changes on any of those paths then it triggers the GHA. I'm wondering if that can be inverted to exclude running GHAs if changes are only in documentation files like .md files.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2025

✅ Gradle check result for 9ec0df0: SUCCESS

@codecov
Copy link

codecov bot commented Jun 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72.60%. Comparing base (6ad6f4e) to head (9ec0df0).
Report is 6 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #18474      +/-   ##
============================================
- Coverage     72.66%   72.60%   -0.06%     
- Complexity    67858    67868      +10     
============================================
  Files          5521     5521              
  Lines        312541   312541              
  Branches      45364    45364              
============================================
- Hits         227113   226935     -178     
- Misses        66903    67089     +186     
+ Partials      18525    18517       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rishabhmaurya
Copy link
Contributor

I'm wondering if that can be inverted to exclude running GHAs if changes are only in documentation files like .md files.

+1

@rishabhmaurya
Copy link
Contributor

rishabhmaurya commented Jun 9, 2025

I'm only concerned about users, who might change the ordering of entries, where merge union may end up with duplicate entries.

@jmazanec15
Copy link
Member

This is pretty cool - I think there is some logic for excluding via paths-ignore (https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore)

@cwperks
Copy link
Member Author

cwperks commented Jun 9, 2025

I'm only concerned about users, who might change the ordering of entries, where merge union may end up with duplicate entries.

I'm not sure how it would look from a reviewers perspective, but something like that should be flagged during review.

This is pretty cool - I think there is some logic for excluding via paths-ignore (https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore)

Nice, that would work well for the core repo where the list of files/file extensions to exclude is smaller then the list to include.

@peternied
Copy link
Member

@cwperks Thanks for this suggestion, it sounds good in theory, lets see how it works in practice by merging this change :D

@peternied peternied merged commit 5fa62e1 into opensearch-project:main Jun 9, 2025
36 of 37 checks passed
@andrross
Copy link
Member

andrross commented Jun 9, 2025

@rishabhmaurya We have logic that skips the gradle check depending on which files are changed, and that does include CHANGELOG.md because of the *.md rule:

check-files:
runs-on: ubuntu-latest
outputs:
RUN_GRADLE_CHECK: ${{ steps.changed-files-specific.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files-specific
uses: tj-actions/changed-files@v46.0.5
with:
files_ignore: |
release-notes/*.md
.github/**
*.md

neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…conflicts (opensearch-project#18474)

Signed-off-by: Craig Perkins <cwperx@amazon.com>Signed-off-by: TJ Neuenfeldt <tjneu@amazon.com>
neuenfeldttj pushed a commit to neuenfeldttj/OpenSearch that referenced this pull request Jun 26, 2025
…conflicts (opensearch-project#18474)

Signed-off-by: Craig Perkins <cwperx@amazon.com>
tandonks pushed a commit to tandonks/OpenSearch that referenced this pull request Aug 5, 2025
…conflicts (opensearch-project#18474)

Signed-off-by: Craig Perkins <cwperx@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Build Build Tasks/Gradle Plugin, groovy scripts, build tools, Javadoc enforcement. skip-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Minimize merge conflicts in CHANGELOG

6 participants