4c6a9854f9
Bumps [YamlDotNet](https://github.com/aaubry/YamlDotNet) from 13.7.1 to 16.1.3. - [Release notes](https://github.com/aaubry/YamlDotNet/releases) - [Commits](https://github.com/aaubry/YamlDotNet/compare/v13.7.1...v16.1.3) --- updated-dependencies: - dependency-name: YamlDotNet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.config | ||
.devcontainer | ||
.github | ||
.ps-rule | ||
.vscode | ||
docs | ||
scripts | ||
src | ||
tests | ||
.editorconfig | ||
.gitignore | ||
.markdownlint.json | ||
CHANGELOG.md | ||
CODE_OF_CONDUCT.md | ||
CONTRIBUTING.md | ||
GitVersion.yml | ||
LICENSE | ||
PSRule.Rules.GitHub.sln | ||
README.md | ||
RuleToc.Doc.ps1 | ||
SECURITY.md | ||
SUPPORT.md | ||
ThirdPartyNotices.txt | ||
build.ps1 | ||
global.json | ||
modules.json | ||
pipeline.build.ps1 | ||
ps-project.yaml | ||
ps-rule.yaml |
README.md
PSRule for GitHub
A suite of rules to validate GitHub repositories using PSRule.
Features of PSRule for GitHub include:
-
Ready to go - Leverage pre-built rules.
-
DevOps - Validate repositories throughout their lifecycle.
-
Cross-platform - Run with GitHub Actions or other CI integrations.
Support
This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates.
- For new issues, file your bug or feature request as a new issue.
- For help, discussion, and support questions about using this project, join or start a discussion.
If you have any problems with the PSRule engine, please check the project GitHub issues page instead.
Support for this project/ product is limited to the resources listed above.
Getting the modules
This project requires the PSRule
PowerShell module. For details on each see install.
You can download and install these modules from the PowerShell Gallery.
Module | Description | Downloads / instructions |
---|---|---|
PSRule.Rules.GitHub | Validate GitHub repositories using PSRule. | latest / instructions |
Getting started
Using with GitHub Actions
The following example shows how to setup GitHub Actions to validate GitHub repositories.
- See [Creating a workflow file][create-workflow].
- Reference
microsoft/ps-rule
withmodules: 'PSRule.Rules.GitHub'
.
For example:
# Example: .github/workflows/analyze-gh.yaml
#
# STEP 1: Repository validation
#
name: Analyze repository
on:
- push
jobs:
analyze_arm:
name: Analyze repository
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# STEP 2: Run analysis against exported data
- name: Analyze repository
uses: microsoft/ps-rule@v2.9.0
with:
modules: 'PSRule.Rules.GitHub'
Using locally
The following example shows how to setup PSRule locally to validate templates pre-flight.
- Install the
PSRule.Rules.GitHub
module and dependencies from the PowerShell Gallery. - Export repository data for analysis.
- Run analysis against a GitHub repository.
For example:
# STEP 1: Install PSRule.Rules.GitHub from the PowerShell Gallery
Install-Module -Name 'PSRule.Rules.GitHub' -Scope CurrentUser;
# STEP 2: Export repository configuration data for microsoft/PSRule
Export-GitHubRuleData -Repository 'microsoft/PSRule';
# STEP 3: Run analysis against exported data
Assert-PSRule -Module 'PSRule.Rules.GitHub' -InputPath './*.json';
The Export-GitHubRuleData
cmdlet exports repository data to JSON.
To export multiple repositories:
- Comma separate each repository.
- Use
<organization>/
to include all repositories in the organization.
Authenticate to export private repositories by:
- Using
-Credential
to specify aPSCredential
object with a personal access token (PAT). The username ofPSCredential
is ignored. - Using
-UseGitHubToken
to read a PAT token from theGITHUB_TOKEN
environment variable.
For advanced usage, see Assert-PSRule help.
Rule reference
For a list of rules included in the PSRule.Rules.GitHub
module see:
Language reference
PSRule for GitHub extends PowerShell with the following features.
Commands
The following commands exist in the PSRule.Rules.GitHub
module:
- Export-GitHubRuleData - Export GitHub repository configuration.
Changes and versioning
Modules in this repository will use the semantic versioning model to declare breaking changes from v1.0.0. Prior to v1.0.0, breaking changes may be introduced in minor (0.x.0) version increments. For a list of module changes please see the change log.
Pre-release module versions are created on major commits and can be installed from the PowerShell Gallery. Pre-release versions should be considered experimental. Modules and change log details for pre-releases will be removed as standard releases are made available.
Contributing
This project welcomes contributions and suggestions. If you are ready to contribute, please visit the contribution guide.
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Maintainers
License
This project is licensed under the MIT License.