Skip to content

Add docs for limiting input to changed files - #3991

Open
Ming (MaxonT) wants to merge 1 commit into
Azure:mainfrom
MaxonT:contrib/716-auto
Open

Ming (MaxonT) wants to merge 1 commit into
Azure:mainfrom
MaxonT:contrib/716-auto

Conversation

@MaxonT

Copy link
Copy Markdown

PSRule already supports this option, so this only adds the missing docs that #716 asked for. Happy to move the section or reword it if you'd like it somewhere else.

PR Summary

This adds a "Limiting input to changed files" section to docs/creating-your-pipeline.md for the input.ignoreUnchangedPath option, plus a change log entry. PSRule added the option in v2.5.0, and the note on #716 says only the PSRule for Azure documentation was still missing.

What the section says comes from the PSRule options documentation and source:

  • input.ignoreUnchangedPath: true in ps-rule.yaml ignores files that have not changed (about_PSRule_Options.md, Input.IgnoreUnchangedPath).
  • PSRule runs git to compare the current commit with the base branch, which is detected from the build system or set with repository.baseRef. With no base branch it compares with HEAD^ (GitHelper.TryGetChangedFiles in microsoft/PSRule).
  • If git is not available or the comparison fails, the changed-files filter is not applied and all files are processed (PipelineBuilderBase.TryChangedFiles and its callers).
  • The advice to fetch more history (fetch-depth: 0 on actions/checkout) follows from the same code: a shallow checkout may not hold the base branch, so the comparison fails and all files are processed. That part is my reasoning from the source, I did not run it in a pipeline.

The section follows the layout of the neighbouring "Limiting input to a specific path" section. It uses a ps-rule.yaml example instead of the tabbed GitHub Actions, Azure Pipelines and PowerShell examples, because the option is set in ps-rule.yaml. I did not find it listed in the microsoft/ps-rule README inputs.

Fixes #716

Testing

Checked:

  • Both PSRule links in the new section return HTTP 200 and their anchors (#inputignoreunchangedpath, #repositorybaseref) exist on the page.
  • markdownlint-cli2 with the repository's .markdownlint.json reports nothing on the added lines. The two files already have findings on other lines, which I left alone.
  • The new reference labels [12] and [13] are not used elsewhere in the file.

Not run: mkdocs build (mkdocs is not installed in my environment) and PSRule itself with the option in a pipeline, so the behaviour above comes from reading the PSRule source and documentation, not from a run.

PR Checklist

  • PR has a meaningful title
  • Summarized changes
  • Change is not breaking
  • This PR is ready to merge and is not Work in Progress
  • Other code changes
    • Unit tests created/ updated (documentation only, no code changed)
    • Link to a filed issue
    • Change log has been updated with change under unreleased section

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.com>
@MaxonT
Ming (MaxonT) requested a review from a team as a code owner November 29, 2026 05:13

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for processing template based on git diff

1 participant