Add reusable get-changed-files action and refactor existing actions#26355
Merged
TravisEz13 merged 7 commits intoPowerShell:masterfrom Oct 30, 2025
Merged
Conversation
- Create new .github/actions/infrastructure/get-changed-files composite action - Supports both pull_request and push events - Optional filtering by file pattern (e.g., '*.md', '.github/') - Full pagination support (fetches all changed files, not just first 100) - Returns JSON array of file paths for easy consumption - Refactor markdownlinks action to use get-changed-files - Reduced from 108 lines to 77 lines (29% reduction) - Eliminated 31 lines of duplicate file retrieval code - Uses secure environment variable instead of direct string interpolation - Refactor path-filters action to use get-changed-files - Reduced from 130 lines to 123 lines - Eliminated 15+ lines of duplicate pagination logic - Fixed JSON security issue: now uses fromJSON() instead of unsafe JSON.parse() - Added detailed logging for filter analysis - Proper escaping prevents potential code injection from filenames Benefits: - Eliminates ~60 lines of duplicate code across actions - Centralizes file retrieval logic in one place - Improves security with proper JSON handling - Ensures consistent behavior across all actions using changed files - Full pagination ensures no files are missed in large PRs
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new reusable composite action get-changed-files to centralize the logic for fetching changed files in PRs and push events, and refactors existing actions to use it. This eliminates code duplication, improves security by using environment variables instead of direct string interpolation, and adds pagination support to handle PRs with more than 100 changed files.
Key changes:
- Created a new
get-changed-filesaction with pagination support, filtering capabilities, and security improvements - Refactored
path-filtersaction to use the newget-changed-filesaction and pass data via environment variables - Updated
markdownlinksaction to use the newget-changed-filesaction for consistency
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.github/actions/infrastructure/get-changed-files/action.yml |
New reusable action that fetches changed files with pagination support, filtering, and hash verification |
.github/actions/infrastructure/get-changed-files/README.md |
Documentation for the new action including usage examples, inputs, outputs, and limitations |
.github/actions/infrastructure/path-filters/action.yml |
Refactored to use get-changed-files action and receive data via environment variables for security; added detailed logging and removed redundant PowerShell output step |
.github/actions/infrastructure/markdownlinks/action.yml |
Updated to use get-changed-files action with filtering instead of inline GitHub API calls |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…able-get-changed-files-action
…s://github.com/travisez13/powershell into refactor/add-reusable-get-changed-files-action
adityapatwardhan
approved these changes
Oct 30, 2025
Contributor
|
📣 Hey @@TravisEz13, how did we do? We would love to hear your feedback with the link below! 🗣️ 🔗 https://aka.ms/PSRepoFeedback |
pwshBot
pushed a commit
to pwshBot/PowerShell
that referenced
this pull request
Oct 31, 2025
9 tasks
TravisEz13
added a commit
to TravisEz13/PowerShell
that referenced
this pull request
Nov 25, 2025
…owerShell#26355) Co-authored-by: Copilot <[email protected]>
9 tasks
SIRMARGIN
pushed a commit
to SIRMARGIN/PowerShell
that referenced
this pull request
Dec 12, 2025
…owerShell#26355) Co-authored-by: Copilot <[email protected]>
kilasuit
pushed a commit
to kilasuit/PowerShell
that referenced
this pull request
Jan 2, 2026
…owerShell#26355) Co-authored-by: Copilot <[email protected]>
daxian-dbw
pushed a commit
to daxian-dbw/PowerShell
that referenced
this pull request
Feb 13, 2026
…owerShell#26355) Co-authored-by: Copilot <[email protected]>
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR creates a new reusable composite action for retrieving changed files and refactors two existing actions to use it, eliminating duplicate code and improving security.
Changes
1. New Get-Changed-Files Action
2. Refactored Markdownlinks Action
3. Refactored Path-Filters Action
Benefits
Code Reuse: Eliminates ~60 lines of duplicate code across actions
Maintainability: Centralizes file retrieval logic in one place - future changes only need to be made once
Security: Fixes JSON injection vulnerability in path-filters
Consistency: All actions using changed files will behave identically
Completeness: Full pagination ensures no files are missed in large PRs
Clarity: Better logging and documentation
Testing
Related
This is part of splitting up PR #26350 into smaller, more manageable chunks. This PR contains the foundation (reusable action) and refactoring work, while the merge conflict checker will come in a separate PR.