Skip to content

[release/v7.5] Add reusable get-changed-files action and refactor existing actions#26811

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

[release/v7.5] Add reusable get-changed-files action and refactor existing actions#26811
daxian-dbw merged 1 commit intoPowerShell:release/v7.5from
daxian-dbw:backport/release/v7.5/26355-a93688463

Conversation

@daxian-dbw
Copy link
Member

Backport of #26355 to release/v7.5

Triggered by @daxian-dbw 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

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

Creates reusable get-changed-files composite action and refactors existing actions to use it

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Validated YAML syntax. Actions maintain backward compatibility. Successfully tested in 7.4 and 7.6 releases.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Refactors GitHub Actions to use a shared reusable action. Reduces code duplication and fixes a JSON security issue. Successfully backported to 7.4 and 7.6 branches.

Merge Conflicts

Minor conflicts in path-filters/action.yml resolved - context differences in file filtering logic

@daxian-dbw daxian-dbw requested a review from a team as a code owner February 13, 2026 21:40
Copilot AI review requested due to automatic review settings February 13, 2026 21:40
@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
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 backports the introduction of a reusable composite GitHub Action to retrieve changed files and refactors existing infrastructure actions to consume it, reducing duplication and improving safety when passing JSON between steps.

Changes:

  • Add a reusable .github/actions/infrastructure/get-changed-files composite action (with README) to return changed files as JSON for PR and push events.
  • Refactor markdownlinks to use get-changed-files with a *.md filter and pass JSON via environment variables.
  • Refactor path-filters to use get-changed-files for PRs and extend its change-detection logging/criteria.

Reviewed changes

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

File Description
.github/actions/infrastructure/path-filters/action.yml Switches PR file enumeration to get-changed-files and expands/clarifies filter logic and logging.
.github/actions/infrastructure/markdownlinks/action.yml Replaces custom changed-file discovery with get-changed-files and uses env var JSON passing.
.github/actions/infrastructure/get-changed-files/action.yml New composite action that fetches changed files for PR/push and optionally filters by simple pattern.
.github/actions/infrastructure/get-changed-files/README.md Documentation and usage examples for the new reusable action.

Comment on lines 134 to 136
core.setOutput('buildModuleChanged', buildModuleChanged);
core.setOutput('globalConfigChanged', globalConfigChanged);
core.setOutput('packagingChanged', packagingChanged);
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.

This step sets globalConfigChanged, but the composite action does not declare an action-level output for it in the outputs: block. Either add an output mapping (so callers can read it) or remove this step output if it isn’t intended to be consumed.

Copilot uses AI. Check for mistakes.
- name: Get changed files
id: get-files
if: github.event_name == 'pull_request'
uses: "./.github/actions/infrastructure/get-changed-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.

get-changed-files currently excludes deleted files (only added/modified/renamed). Using it for path-based change detection means deletions of workflow/tools/source files will no longer flip these flags, potentially skipping required CI. Consider adding an input to include deleted files (or return statuses) and use that mode here, so deletions are treated as changes.

Suggested change
uses: "./.github/actions/infrastructure/get-changed-files"
uses: "./.github/actions/infrastructure/get-changed-files"
with:
include_deleted: true

Copilot uses AI. Check for mistakes.
steps:
- name: Get changed files
id: get-files
uses: actions/github-script@v7
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.

Pin actions/github-script to a specific patch version (as done elsewhere in this repo, e.g. actions/[email protected]) to reduce supply-chain risk and keep builds reproducible.

Suggested change
uses: actions/github-script@v7
uses: actions/github-script@v7.0.1

Copilot uses AI. Check for mistakes.
- Optional filtering by file pattern
- Returns files as JSON array for easy consumption
- Filters out deleted files (only returns added, modified, or renamed files)
- Handles up to 100 changed files per request
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 README feature list says the action "Handles up to 100 changed files per request", but the Pagination section later states there is "No file limit" for PRs. Please update the features bullet to match the current pagination behavior (and clarify if push events still have API limits).

Suggested change
- Handles up to 100 changed files per request
- Supports pagination for pull requests (no file limit) and respects GitHub API limits for push events (up to 100 files per request)

Copilot uses AI. Check for mistakes.
Comment on lines 132 to 137
core.setOutput('testsChanged', testsChanged);
core.setOutput('mainSourceChanged', mainSourceChanged);
core.setOutput('buildModuleChanged', buildModuleChanged);
core.setOutput('globalConfigChanged', globalConfigChanged);
core.setOutput('packagingChanged', packagingChanged);
core.setOutput('source', source);
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.

packagingChanged is used by callers to gate packaging jobs, but in the non-PR branch earlier in this script the action sets several outputs to true and does not set packagingChanged. Ensure the non-PR path sets packagingChanged explicitly (likely true) so push/workflow_dispatch runs don’t accidentally skip packaging.

Copilot uses AI. Check for mistakes.
@daxian-dbw daxian-dbw merged commit 59c2639 into PowerShell:release/v7.5 Feb 13, 2026
29 of 32 checks passed
@daxian-dbw daxian-dbw deleted the backport/release/v7.5/26355-a93688463 branch February 13, 2026 22:09
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.

3 participants