Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 30, 2025

Implementation Complete: Path-Filters Now Detects Deleted Files ✅

Problem Solved

  • path-filters was not detecting deleted files, causing CI jobs to be skipped when files were removed
  • markdownlinks should NOT include deleted files (can't verify links in deleted files)

Solution Implemented

Added configurable deletion handling to get-changed-files action with safe defaults:

  • Default: include-deleted: false (backward compatible)
  • Path-filters: Uses include-deleted: true (detects deletions)
  • Markdownlinks: Uses default false (skips deletions)

Changes Made

1. Enhanced get-changed-files action

  • ✅ Added include-deleted input parameter (default: false)
  • ✅ Updated logic to include removed status when enabled
  • ✅ Works for both pull_request and push events
  • ✅ Maintains backward compatibility
  • ✅ Refactored filter logic to eliminate duplication (helper function)

2. Updated path-filters action

  • ✅ Now passes include-deleted: 'true' to get-changed-files
  • ✅ Will detect deleted source files, tests, and build configs
  • ✅ CI will run when files are deleted

3. Markdownlinks unchanged

  • ✅ Uses default include-deleted: false (correct behavior)
  • ✅ Won't try to verify links in deleted files

4. Documentation updated

  • ✅ README explains new parameter
  • ✅ Usage examples provided
  • ✅ Guidance on when to use the parameter

Test Results

  • ✅ YAML syntax validated
  • ✅ Logic verified with test scenarios
  • ✅ Backward compatibility confirmed
  • ✅ All target behaviors working correctly
  • ✅ Code duplication eliminated

Impact

Fixed: Deletion-only PRs now trigger CI (was skipped before)
Safe: Markdownlinks still only checks existing files
Compatible: No breaking changes to existing workflows
Clean: Refactored to reduce code duplication

Original prompt

This section details on the original issue you should resolve

<issue_title>Path-filters composite action should find deleted files</issue_title>
<issue_description>### Summary of the new feature / enhancement

Path-filters composite action should find deleted files

But markdownlinks should not

Proposed technical implementation details (optional)

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…path-filters

Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for finding deleted files in path-filters action Add include-deleted parameter to get-changed-files for path-filters Oct 30, 2025
Copilot AI requested a review from TravisEz13 October 30, 2025 21:41
Copilot finished work on behalf of TravisEz13 October 30, 2025 21:41
@TravisEz13 TravisEz13 added the CL-Tools Indicates that a PR should be marked as a tools change in the Change Log label Oct 31, 2025
@TravisEz13 TravisEz13 marked this pull request as ready for review October 31, 2025 00:38
@TravisEz13 TravisEz13 requested review from a team and jshigetomi as code owners October 31, 2025 00:38
Copilot AI review requested due to automatic review settings October 31, 2025 00:38
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 PR adds the ability to optionally include deleted files in the get-changed-files action results. The new include-deleted input parameter defaults to false to preserve backward compatibility, but can be set to true when deleted files need to be detected.

Key changes:

  • Added include-deleted input parameter to the get-changed-files action (defaults to false)
  • Updated filter logic to include files with removed status when include-deleted is true
  • Updated path-filters action to include deleted files for change detection

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
.github/actions/infrastructure/get-changed-files/action.yml Added include-deleted input and updated filter logic for both pull_request and push events to optionally include removed files
.github/actions/infrastructure/path-filters/action.yml Configured to use include-deleted: 'true' for comprehensive change detection
.github/actions/infrastructure/get-changed-files/README.md Updated documentation to explain the new parameter, its use cases, and when to exclude deleted files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 64 to 70
.filter(file => {
if (includeDeleted) {
return file.status === 'added' || file.status === 'modified' || file.status === 'renamed' || file.status === 'removed';
} else {
return file.status === 'added' || file.status === 'modified' || file.status === 'renamed';
}
})
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

The filter logic duplicates the status checks between the if and else branches. Consider refactoring to reduce duplication by building the status check dynamically or extracting the common conditions.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored to use a helper function filterByStatus with an allowedStatuses array, eliminating the duplication. Commit: 36dcb41

Comment on lines 85 to 91
.filter(file => {
if (includeDeleted) {
return file.status === 'added' || file.status === 'modified' || file.status === 'renamed' || file.status === 'removed';
} else {
return file.status === 'added' || file.status === 'modified' || file.status === 'renamed';
}
})
Copy link

Copilot AI Oct 31, 2025

Choose a reason for hiding this comment

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

This filter logic is duplicated from lines 64-70 for the pull_request event. Consider extracting this logic into a shared inline function or constant array to reduce duplication and maintain consistency between both event types.

Copilot uses AI. Check for mistakes.
Copy link
Member

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extracted the filter logic into a shared filterByStatus helper function that's used by both event types. Commit: 36dcb41

Copy link
Contributor Author

Copilot AI commented Nov 4, 2025

@TravisEz13 Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub.

You can ask me to try again later by mentioning me in a new comment.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: 3bae4716-f409-4993-b2a9-be74b3f5e28d

Sorry for the inconvenience!

Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Copilot AI requested a review from TravisEz13 November 4, 2025 00:43
Copilot finished work on behalf of TravisEz13 November 4, 2025 00:43
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.

Path-filters composite action should find deleted files

2 participants