-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add include-deleted parameter to get-changed-files for path-filters #26357
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
base: master
Are you sure you want to change the base?
Conversation
…path-filters Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
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 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-deletedinput parameter to theget-changed-filesaction (defaults tofalse) - Updated filter logic to include files with
removedstatus wheninclude-deletedistrue - Updated
path-filtersaction 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.
| .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'; | ||
| } | ||
| }) |
Copilot
AI
Oct 31, 2025
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.
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.
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.
@copilot apply changes based on this feedback
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.
Refactored to use a helper function filterByStatus with an allowedStatuses array, eliminating the duplication. Commit: 36dcb41
| .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'; | ||
| } | ||
| }) |
Copilot
AI
Oct 31, 2025
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.
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.
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.
@copilot apply changes based on this feedback
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.
Extracted the filter logic into a shared filterByStatus helper function that's used by both event types. Commit: 36dcb41
|
@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: Sorry for the inconvenience! |
Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Implementation Complete: Path-Filters Now Detects Deleted Files ✅
Problem Solved
Solution Implemented
Added configurable deletion handling to
get-changed-filesaction with safe defaults:include-deleted: false(backward compatible)include-deleted: true(detects deletions)false(skips deletions)Changes Made
1. Enhanced get-changed-files action
include-deletedinput parameter (default:false)removedstatus when enabled2. Updated path-filters action
include-deleted: 'true'to get-changed-files3. Markdownlinks unchanged
include-deleted: false(correct behavior)4. Documentation updated
Test Results
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
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.