Closed DevAlphaKilo closed 3 years ago
@DevAlphaKilo Thanks for reporting the issue.
If you are using the binding.targetType
in ps-rule.yaml
configuration can you please provide this.
Additionally are you able to provide the -Type
or -If
filter for you rules in .github/.ps-rule/GitHub.Community.Rule.ps1
.
There was a number of changes in PSRule release v0.20.0 that improved repository scanning, however the object type for binding is slightly different. Double checking this now, this could be a gap in the documentation, so I will look to address this.
In a nutshell:
-Type 'System.IO.DirectoryInfo'
update this to -Type 'PSRule.Data.RepositoryInfo'
.-Type '.ps1', '.psd1', '.psm1'
Example here: https://github.com/microsoft/PSRule/blob/main/.ps-rule/OpenSource.Rule.ps1
Hope that helps.
@DevAlphaKilo Added upgrade notes. https://github.com/microsoft/ps-rule/blob/main/docs/upgrade-notes.md
The suggestion about updating the binding.targetType fixed the issue. Thank you!
"Broken" Rule
Rule 'GitHub.Community' -Type 'System.IO.DirectoryInfo'
Working Rule
Rule 'GitHub.Community' -Type 'PSRule.Data.RepositoryInfo'
Description of the issue
When using the current release of PSRule my rules are no longer found/detected in the .ps-rule directory nested in my .github directory.
Expected behaviour
*.Rule.ps1 files should be detected.
To Reproduce
Steps to reproduce the issue:
Working
Rule file is detected
Not Working
Rule file is NOT detected
Error output
Capture any error messages and or run output.
Action version:
Additional context
This format has previously worked for me on other repositories in the past by targeting main but now I have to explicitly target v0.2.0 to have it work correctly as expected.