A suite of rules to validate GitHub repositories using PSRule.
Перейти к файлу
dependabot[bot] 4c6a9854f9
Bump YamlDotNet from 13.7.1 to 16.1.3
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>
2024-10-23 22:57:55 +00:00
.config Update .NET requirements (#275) 2024-10-24 08:56:38 +10:00
.devcontainer Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00
.github Update .NET requirements (#275) 2024-10-24 08:56:38 +10:00
.ps-rule Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00
.vscode Bump Microsoft.PowerShell.SDK, System.Management.Automation and Newtonsoft.Json (#264) 2024-07-13 14:32:43 +10:00
docs Added publishing as NuGet #132 (#139) 2022-08-04 14:59:11 +10:00
scripts Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00
src Bump YamlDotNet from 13.7.1 to 16.1.3 2024-10-23 22:57:55 +00:00
tests Update .NET requirements (#275) 2024-10-24 08:56:38 +10:00
.editorconfig Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00
.gitignore Add project files #1 #6 #7 #8 (#9) 2020-07-28 16:39:03 +10:00
.markdownlint.json Updates to documentation and community rules #3 (#18) 2020-07-30 14:32:11 +10:00
CHANGELOG.md Bump xunit from 2.7.1 to 2.9.0 (#263) 2024-07-13 14:46:23 +10:00
CODE_OF_CONDUCT.md Initial commit 2020-07-22 23:17:49 +10:00
CONTRIBUTING.md Updated contributing and other minor corrections (#33) 2020-09-10 13:47:13 +10:00
GitVersion.yml Packaging updates (#130) 2022-07-17 16:19:26 +10:00
LICENSE Initial commit 2020-07-22 23:17:49 +10:00
PSRule.Rules.GitHub.sln Added publishing as NuGet #132 (#139) 2022-08-04 14:59:11 +10:00
README.md Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00
RuleToc.Doc.ps1 Updates to documentation and community rules #3 (#18) 2020-07-30 14:32:11 +10:00
SECURITY.md Initial commit 2020-07-22 23:17:49 +10:00
SUPPORT.md Added export data #63 #64 #65 #66 #67 (#68) 2021-04-20 02:13:29 +10:00
ThirdPartyNotices.txt Add project files #1 #6 #7 #8 (#9) 2020-07-28 16:39:03 +10:00
build.ps1 Added pipeline files (#12) 2020-07-28 17:15:37 +10:00
global.json Update .NET requirements (#275) 2024-10-24 08:56:38 +10:00
modules.json Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00
pipeline.build.ps1 Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00
ps-project.yaml Packaging updates (#130) 2022-07-17 16:19:26 +10:00
ps-rule.yaml Update to build process and tool chain (#231) 2024-01-17 23:16:48 +10:00

README.md

PSRule for GitHub

A suite of rules to validate GitHub repositories using PSRule.

Open in vscode.dev

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.

  1. See [Creating a workflow file][create-workflow].
  2. Reference microsoft/ps-rule with modules: '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.

  1. Install the PSRule.Rules.GitHub module and dependencies from the PowerShell Gallery.
  2. Export repository data for analysis.
  3. 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 a PSCredential object with a personal access token (PAT). The username of PSCredential is ignored.
  • Using -UseGitHubToken to read a PAT token from the GITHUB_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:

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.