-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add merge conflict marker detection to linux-ci workflow and refactor existing actions to use reusable get-changed-files action #26350
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
Add merge conflict marker detection to linux-ci workflow and refactor existing actions to use reusable get-changed-files action #26350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds automated detection of Git merge conflict markers in pull requests to prevent accidentally merging unresolved conflicts into the codebase. The implementation creates a new composite GitHub Action that scans changed files for conflict markers (<<<<<<<, =======, >>>>>>>) and fails the workflow if any are found.
Key changes:
- New composite action for detecting merge conflict markers in PR files
- Integration into the Linux CI workflow with a dedicated job
- Test files demonstrating different conflict marker scenarios
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
.github/actions/infrastructure/merge-conflict-checker/action.yml |
Main composite action implementing the conflict detection logic using GitHub API and PowerShell |
.github/actions/infrastructure/merge-conflict-checker/README.md |
Documentation explaining usage, behavior, and integration of the action |
.github/workflows/linux-ci.yml |
Adds the merge conflict check job to the Linux CI workflow and includes it in the ready-to-merge dependencies |
test/merge-conflict-markers/test-*.txt |
Test files containing various conflict marker patterns for validation purposes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
.github/actions/infrastructure/merge-conflict-checker/action.yml
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
… and add tests for its functionality
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
📣 Hey @@Copilot, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
… existing actions to use reusable get-changed-files action (PowerShell#26350) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Travis Plunk (HE/HIM) <tplunk@ntdev.microsoft.com>
… existing actions to use reusable get-changed-files action (PowerShell#26350) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com> Co-authored-by: Travis Plunk <travis.plunk@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Travis Plunk (HE/HIM) <tplunk@ntdev.microsoft.com>
Summary
This PR adds automated detection of Git merge conflict markers in pull requests to prevent accidentally merging unresolved conflicts into the PowerShell repository.
What This PR Does
Adds Merge Conflict Marker Detection
.github/actions/infrastructure/merge-conflict-checkermerge_conflict_checkjobready_to_mergedependencies)Implements Detection Logic in PowerShell Module
Test-MergeConflictMarkerfunction intools/ci.psm1Select-Stringcmdlet for efficient pattern matching with automatic line numbering<<<<<<<,=======,>>>>>>>Adds Developer Documentation
.github/instructions/powershell-module-organization.instructions.md- Guidelines for organizing PowerShell code across ci.psm1, build.psm1, and packaging.psm1 modules.github/instructions/powershell-automatic-variables.instructions.md- Comprehensive guide on avoiding PowerShell automatic variables like$matches,$_,$args, and$inputTechnical Implementation
Detection Logic:
^(<{7}|={7}|>{7})(\s|$)- matches 7 consecutive markers at line start, followed by whitespace or end-of-line<<<<<<< HEAD)Code Quality:
Functionkeyword, singular parameter names)$matchedLinesinstead of$matches)Security:
ErrorAction StopFiles Changed
New Files:
.github/workflows/linux-ci.yml- Addedmerge_conflict_checkjob.github/actions/infrastructure/merge-conflict-checker/action.yml- Composite action.github/actions/infrastructure/merge-conflict-checker/README.md- Action documentation.github/instructions/powershell-module-organization.instructions.md- Module organization guidelines.github/instructions/powershell-automatic-variables.instructions.md- Automatic variables guideModified Files:
tools/ci.psm1- AddedTest-MergeConflictMarkerfunctionNext Steps (Not Included in This PR)
Test-MergeConflictMarkerfunction intest/infrastructure/(per reviewer request)Benefits
Fixes #26349
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.