How to contribute to this module
Please note: As a loose rule any pull requests for general code cleanup will generally be merged when a new version is released. I have a limited number of hours per week to review and test pull requests. I will do my best to test pull requests within a reasonable time frame, but no guarantees can be made
Did you find a bug?
-
Ensure the bug was not already reported by searching on GitHub under Issues
-
If you’re unable to find an open issue addressing the problem, open a new one
- Be sure to include a title and clear description, as much relevant information as possible, and a code sample or an executable test case demonstrating the expected behavior that is not occurring
- Never paste a token. Remove credentials from verbose or debug output (the module redacts the
Authorizationheader, but check)
Did you write a patch that fixes a bug?
- Submit a pull request to the main branch
- Ensure the pull request description clearly describes the problem and solution
If the feature is accepted and I have time to test, the pull request will be approved
Do you intend to add a new feature or change an existing one?
-
Suggest your change by creating a GitHub issue tagged with “Enhancement”
-
Create a branch and start working on your new feature, following feedback from the community
-
Once the new feature is ready,
- Update any documentation if needed
- Submit a pulling request to the main branch
If the feature is accepted and I have time to test, the pull request will be approved
Development setup
git clone https://github.com/Celerium/Celerium.GitHub.git
cd Celerium.GitHub
./build/Install-Prerequisites.ps1 # installs the pinned module versions (CurrentUser scope)
./build/Install-Prerequisites.ps1 -CheckOnly # validates them without installing
The pinned versions are in build/Prerequisites.psd1. That file is the only place that lists them. The
generator, spec, and documentation scripts need PowerShell 7+, the module and the tests also run on Windows PowerShell 5.1.
What is generated and what is not
| Path | Edit by hand? |
|---|---|
Celerium.GitHub/Public/<Category>/*.ps1 (not Core) |
No, generated by build/New-PublicFunctions.ps1 |
Celerium.GitHub/Celerium.GitHub.psd1 FunctionsToExport and AliasesToExport |
No, generated |
docs/endpoints.csv |
No, generated |
docs/site/**, docs/index.md, docs/TrackingCSV.md |
No, generated by build/Invoke-HelpContent.ps1 |
docs/DocumentationEndpoints.csv, docs/EndpointDiscrepancies.md |
No, generated by build/Compare-GitHubSpec.ps1 |
Celerium.GitHub/Public/Core, Celerium.GitHub/Private, build/** (except the outputs above), tests/**, examples/** |
Yes |
To change what a generated command looks like, change the generator (build/New-PublicFunctions.ps1, build/Helpers) and run it again.
CI runs the generator and fails when the committed files differ.
Update to a newer spec
./build/Get-GitHubSpec.ps1 # downloads docs/api.github.com.<ApiVersion>.json, reports added/removed operations
./build/New-PublicFunctions.ps1 # regenerate commands, manifest lists, docs/endpoints.csv
./build/Compare-GitHubSpec.ps1 # optional: compare with docs.github.com
./build/Invoke-HelpContent.ps1 # regenerate the documentation
Test
./build/Invoke-PesterTests.ps1 -Version 2.0.0 # source module, NUnit XML in build/
./build/Invoke-ModuleBuild.ps1 -Version 2.0.0
./build/Invoke-PesterTests.ps1 -Version 2.0.0 -BuildTarget built
./build/Invoke-PesterTests.ps1 -Version 2.0.0 -Path ./tests/Build # only the build tests
The tests never use the network or a token (HTTP is mocked at Send-GitHubHttpRequest). Tests tagged Live (in tests/Live)
are excluded by default and need GITHUB_TOKEN; they create and delete a temporary private repository in your account.
Coding conventions (enforced by build/Test-NamingConvention.ps1 and CI)
- Functions are
Verb-Nounwith an approved verb (Get-Verb); commands of the module areVerb-GitHub<Noun> - Parameters and every project defined variable are PascalCase (
$PageNumber, not$pageNumber;$Index, not$i). Automatic and preference variables ($_,$PSItem,$true,$PSBoundParameters,$env:...,$TestDrive) are exempt - Call commands by their full name, never by an alias (
Where-Object, not?) - 4 space indent,
#Regionblocks, a.NOTESheader block in scripts, UTF-8 without BOM, LF line endings - Keep
Write-Verbosetiming (START/END) in build scripts andexit 1on failure so CI notices - Never log or commit a token; never hardcode one in an example
Thanks! :heart:
Based off of the Ruby on Rails project contribution guide