Skip to content

[release/v7.5] Add merge conflict marker detection to linux-ci workflow and refactor existing actions to use reusable get-changed-files action#26812

Merged
daxian-dbw merged 1 commit intoPowerShell:release/v7.5from
daxian-dbw:backport/release/v7.5/26350-0c40a84ab
Feb 13, 2026
Merged

[release/v7.5] Add merge conflict marker detection to linux-ci workflow and refactor existing actions to use reusable get-changed-files action#26812
daxian-dbw merged 1 commit intoPowerShell:release/v7.5from
daxian-dbw:backport/release/v7.5/26350-0c40a84ab

Conversation

@daxian-dbw
Copy link
Member

Backport of #26350 to release/v7.5

Triggered by @daxian-dbw on behalf of @app/copilot-swe-agent

Original CL Label: CL-Tools

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

Adds merge conflict marker detection to prevent accidentally merging unresolved conflicts

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

New infrastructure tests verify Test-MergeConflictMarker function. Successfully tested in 7.4 and 7.6 releases. Action runs on PR events only.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Adds automated merge conflict detection to CI workflow. New job runs independently and doesn't affect existing build/test logic. Successfully backported to 7.4 and 7.6 branches.

Merge Conflicts

Conflicts in linux-ci.yml resolved - differences in job definitions and dependencies

… existing actions to use reusable get-changed-files action (PowerShell#26350)

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: TravisEz13 <[email protected]>
Co-authored-by: Travis Plunk <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Travis Plunk (HE/HIM) <[email protected]>
@daxian-dbw daxian-dbw requested a review from a team as a code owner February 13, 2026 21:57
@daxian-dbw daxian-dbw added the CL-Tools Indicates that a PR should be marked as a tools change in the Change Log label Feb 13, 2026
Copilot AI review requested due to automatic review settings February 13, 2026 21:57
Copy link
Contributor

Copilot AI left a 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 is a backport of PR #26350 to the release/v7.5 branch, which adds automated detection of Git merge conflict markers to prevent them from being accidentally merged. The PR also introduces a new Install-CIPester function to standardize Pester installation across CI workflows and adds comprehensive infrastructure tests and developer documentation.

Changes:

  • Adds Test-MergeConflictMarker function to detect Git conflict markers in changed files
  • Introduces Install-CIPester function to standardize Pester module installation with version validation
  • Adds infrastructure tests for the new CI module functions with comprehensive test coverage
  • Integrates merge conflict checking and infrastructure testing into the linux-ci workflow
  • Includes developer documentation on PowerShell module organization and automatic variable naming conventions

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/ci.psm1 Adds Install-CIPester and Test-MergeConflictMarker functions; refactors existing Pester installation to use the new Install-CIPester function
test/infrastructure/ciModule.Tests.ps1 New test file with comprehensive Pester tests for Test-MergeConflictMarker and Install-CIPester functions
.github/workflows/linux-ci.yml Adds merge_conflict_check job, infrastructure_tests job, and comments out analyze job; updates ready_to_merge dependencies
.github/workflows/macos-ci.yml Adds Install-CIPester step before package content testing
.github/actions/infrastructure/merge-conflict-checker/action.yml New composite action that calls Test-MergeConflictMarker via get-changed-files action
.github/actions/infrastructure/merge-conflict-checker/README.md Documentation for the merge conflict checker action
.github/actions/test/linux-packaging/action.yml Adds Install-CIPester step before package validation tests
.github/instructions/powershell-module-organization.instructions.md New developer guidance on organizing PowerShell code across ci.psm1, build.psm1, and packaging.psm1
.github/instructions/powershell-automatic-variables.instructions.md New developer guidance on avoiding PowerShell automatic variable conflicts
.vsts-ci/templates/nanoserver.yml Removed (deprecated nanoserver test template)

@@ -178,6 +235,9 @@ jobs:
- linux_test_unelevated_others
- analyze
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The analyze job is referenced in the needs list but the job itself is commented out (lines 216-226). This will cause a workflow validation error because the job doesn't exist. Since the analyze job is disabled, this dependency reference should also be commented out to match line 240 where it appears as a comment.

Suggested change
- analyze
# - analyze

Copilot uses AI. Check for mistakes.
$filesChecked++

# Get relative path for display
$relativePath = if ($WorkspacePath -and $filePath.StartsWith($WorkspacePath)) {
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Path comparison should use case-insensitive comparison for cross-platform compatibility. The current code uses $filePath.StartsWith($WorkspacePath) which is case-sensitive and may fail on case-insensitive file systems like Windows.

Change to: $filePath.StartsWith($WorkspacePath, [System.StringComparison]::OrdinalIgnoreCase)

Suggested change
$relativePath = if ($WorkspacePath -and $filePath.StartsWith($WorkspacePath)) {
$relativePath = if ($WorkspacePath -and $filePath.StartsWith($WorkspacePath, [System.StringComparison]::OrdinalIgnoreCase)) {

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +24
uses: "./.github/actions/infrastructure/get-changed-files"

- name: Check for merge conflict markers
id: check
shell: pwsh
env:
CHANGED_FILES_JSON: ${{ steps.changed-files.outputs.files }}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The action references a non-existent action ./.github/actions/infrastructure/get-changed-files on line 18. This action does not exist in the repository and will cause the merge-conflict-checker action to fail.

According to the PR description, this is a backport from PR #26350. The original PR likely included the get-changed-files action, but it appears to have been omitted from this backport. You need to either:

  1. Include the get-changed-files action in this backport, or
  2. Modify this action to get changed files using a different method (such as using the GitHub API directly or a third-party action like tj-actions/changed-files)
Suggested change
uses: "./.github/actions/infrastructure/get-changed-files"
- name: Check for merge conflict markers
id: check
shell: pwsh
env:
CHANGED_FILES_JSON: ${{ steps.changed-files.outputs.files }}
uses: tj-actions/changed-files@v45
- name: Prepare changed files JSON
id: prepare-files
shell: pwsh
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
# Convert newline-separated list of changed files to JSON array
$changedFiles = $env:CHANGED_FILES -split "`n" | Where-Object { -not [string]::IsNullOrWhiteSpace($_) }
$filesJson = $changedFiles | ConvertTo-Json -Compress
"files=$filesJson" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Check for merge conflict markers
id: check
shell: pwsh
env:
CHANGED_FILES_JSON: ${{ steps.prepare-files.outputs.files }}

Copilot uses AI. Check for mistakes.
Comment on lines +225 to +226
Set-ItResult -Skipped -Because "Test requires CI environment to safely install Pester"
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing return statement after Set-ItResult -Skipped. According to the codebase convention (see test/powershell/engine/Module/NewModuleManifest.Tests.ps1:137-138, 148-149), when using Set-ItResult in Pester tests, you must always follow it with a return statement to prevent further test execution. Without the return, the test continues and may fail with unrelated errors.

Add return on the line following the Set-ItResult call.

Copilot uses AI. Check for mistakes.
Comment on lines +233 to +234
Set-ItResult -Skipped -Because "Test requires CI environment to safely install Pester"
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing return statement after Set-ItResult -Skipped. According to the codebase convention (see test/powershell/engine/Module/NewModuleManifest.Tests.ps1:137-138, 148-149), when using Set-ItResult in Pester tests, you must always follow it with a return statement to prevent further test execution. Without the return, the test continues and may fail with unrelated errors.

Add return on the line following the Set-ItResult call.

Copilot uses AI. Check for mistakes.
@daxian-dbw daxian-dbw merged commit 4580712 into PowerShell:release/v7.5 Feb 13, 2026
23 of 24 checks passed
@daxian-dbw daxian-dbw deleted the backport/release/v7.5/26350-0c40a84ab branch February 13, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Tools Indicates that a PR should be marked as a tools change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants