-
Notifications
You must be signed in to change notification settings - Fork 8.1k
[release/v7.6] Add reusable get-changed-files action and refactor existing actions #26529
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
[release/v7.6] Add reusable get-changed-files action and refactor existing actions #26529
Conversation
…owerShell#26355) Co-authored-by: Copilot <175728472+Copilot@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 backports a refactoring of GitHub Actions infrastructure by introducing a new reusable get-changed-files action. The refactoring consolidates duplicate file-fetching logic from multiple actions into a single, well-tested component that properly handles pagination and security.
Key Changes
- New reusable action: Created
get-changed-filesaction with pagination support, optional filtering, and support for both pull_request and push events - Security improvements: Refactored both
path-filtersandmarkdownlinksactions to use environment variables instead of direct output interpolation, preventing script injection attacks - Enhanced packaging detection: Added Linux-specific files (linux-ci.yml and test/packaging/linux/) to the packaging change detection logic in path-filters
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
.github/actions/infrastructure/get-changed-files/action.yml |
New composite action that fetches changed files with pagination, filtering support, and hash-based verification |
.github/actions/infrastructure/get-changed-files/README.md |
Comprehensive documentation for the new action including usage examples, input/output specifications, and pagination details |
.github/actions/infrastructure/path-filters/action.yml |
Refactored to use get-changed-files action, improved security by using environment variables, added detailed logging with collapsible groups, and enhanced packaging detection for Linux |
.github/actions/infrastructure/markdownlinks/action.yml |
Simplified by delegating file fetching to get-changed-files action and improved security using environment variables |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix README.md: Change "Handles up to 100 changed files" to "Handles all changed files (no limit)" - Fix README.md: Add actions/checkout step to basic usage example - Fix README.md: Improve limitations section with better filter pattern description - Fix action.yml: Change filter logic to use case-sensitive comparison for consistency with git Co-authored-by: TravisEz13 <10873629+TravisEz13@users.noreply.github.com>
Backport of #26355 to release/v7.6
Triggered by @TravisEz13 on behalf of @TravisEz13
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
Adds a new reusable get-changed-files action that both markdownlinks and path-filters actions now use. This refactoring improves code reusability and maintainability of GitHub Actions infrastructure.
Customer Impact
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
The new get-changed-files action handles pagination correctly to fetch all changed files. The refactored actions (markdownlinks and path-filters) maintain identical behavior to the previous versions. Verified that all action outputs remain the same after refactoring.
Risk
REQUIRED: Check exactly one box.
This refactors critical GitHub Actions used in CI/CD pipeline. While the logic is identical to the previous implementation, the new reusable action pattern introduces a new layer of abstraction that should be monitored. The refactoring removes the old inline logic and replaces it with calls to the new action, reducing code duplication.
Merge Conflicts
One file had merge conflicts during cherry-pick:
.github/actions/infrastructure/path-filters/action.yml. The conflict was in the packagingChanged detection logic where the release branch was using old code that checkedfile.filenameinstead offile. The refactored version uses the newfilestring format (direct file paths) that the new get-changed-files action provides. The conflict was resolved by applying the refactored logic from the original PR.