ResourceModules icon indicating copy to clipboard operation
ResourceModules copied to clipboard

[PSRule] Run PSRule pre-flight validation on diff (PR check)

Open eriqua opened this issue 3 years ago • 4 comments

CARML already has linter and broken links checks running when pull requests are open. The check is not blocking for the PR to be merged.

Note: pull_requests trigger works only for PRs opened from branches, not from forks.

This issue is about extending the PR checks to also run PSRule pre-flight validation on diff (on the code changed by the PR). As a first step, the suggestion is to keep the check non-blocking, allowing PRs to be merged even if they fail PSRule checks.

PR #2094 hosts a PoC running on the whole library. That should be updated to run only on diff.

Collect feedback on the PR and agree on possible missing implementation before merge.

eriqua avatar Sep 29 '22 23:09 eriqua

Suggestion: Move to todo, but wait for #2425 completion. Meanwhile research on how to run PSRule on diff only

eriqua avatar Dec 10 '22 16:12 eriqua

To run PSRule on changed files only ref https://github.com/microsoft/PSRule/blob/main/docs/concepts/PSRule/en-US/about_PSRule_Options.md#inputignoreunchangedpath

# GitHub Actions: Using environment variable
env:
  PSRULE_INPUT_IGNOREUNCHANGEDPATH: true


Ref also https://github.com/microsoft/PSRule/issues/688

eriqua avatar Feb 19 '23 00:02 eriqua

Enabling the option results anyway in a check on the whole repository. This may be due to the token replacement logic, actually changing the files we're supposed to ignore. This needs to be double checked. If confirmed, we should implement a logic that 1. first retrieves changed files, then 2. applies token replacement, then 3. runs psrule only on diff retrieved by step 1

eriqua avatar Apr 01 '23 13:04 eriqua

@eriqua Happy to take feedback on this if you can provide more details here or offline.

BernieWhite avatar Apr 27 '23 14:04 BernieWhite