microsoft / PSRule.Rules.GitHub

A suite of rules to validate GitHub repositories using PSRule.
MIT License
21 stars 15 forks source link

Module not working #128

Closed Dylan-Prins closed 2 years ago

Dylan-Prins commented 2 years ago

Description of the issue

I know it is still a 0.2.0, but would be great if some things already work. Can't wait till you get this working!

To Reproduce

Steps to reproduce the issue:

Install-Module -Name 'PSRule.Rules.GitHub' -Scope CurrentUser;
Export-GitHubRuleData -Repository dylanprins93/
Assert-PSRule -Module 'PSRule.Rules.GitHub' -InputPath .\*.json -Format File;

Expected behaviour

Well, something...

Error output

Capture any error messages and or verbose messages with -Verbose.

VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\Baseline.Rule.yaml    
VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\Config.Rule.yaml      
VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\Convention.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.ExpandRepository in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\Convention.Rule.ps1
VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Branch.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Branch.Name in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Branch.Rule.ps1
VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Common.Rule.ps1
VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.Protected in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.CodeOfConduct in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.Contributing in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.Readme in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.CodeOwners in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.License in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.Description in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.IssueTempate in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Found PSRule.Rules.GitHub\GitHub.Repo.PRTemplate in C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\GitHub.Repo.Rule.ps1
VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\Baseline.Rule.yaml    
VERBOSE: [PSRule][D] -- Discovering rules in: C:\Users\DylanPrins\OneDrive - InSpark\Documenten\PowerShell\Modules\PSRule.Rules.GitHub\0.2.0\rules\Config.Rule.yaml      
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Branch.Name] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.Protected] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.CodeOfConduct] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.Contributing] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.Readme] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.CodeOwners] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.License] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.Description] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.IssueTempate] :: github-22a87384.json
VERBOSE: [PSRule][R][0][PSRule.Rules.GitHub\GitHub.Repo.PRTemplate] :: github-22a87384.json
   WARN  Target object 'github-22a87384.json' has not been processed because no matching rules were found.

Module in use and version:

Captured output from $PSVersionTable:

Name                           Value
----                           -----
PSVersion                      7.2.5
PSEdition                      Core
GitCommitId                    7.2.5
OS                             Microsoft Windows 10.0.22000
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Additional context

Add any other context about the problem here. github-22a87384.json.txt

BernieWhite commented 2 years ago

@Dylan-Prins Thanks for reporting the issue.

The documentation for executing manually is incorrect, I'll correct that. Use the command-line without the -Format File parameter. For example:

Install-Module -Name 'PSRule.Rules.GitHub' -Scope CurrentUser;
Export-GitHubRuleData -Repository dylanprins93/
Assert-PSRule -Module 'PSRule.Rules.GitHub' -InputPath .\*.json;

This is because we need to perform analysis of the file contents and it needs to be read directly as JSON.