1
+ <#
2
+ . SYNOPSIS
3
+ Project Contribution Guide
4
+ . DESCRIPTION
5
+ Contributing to the Project
6
+ . NOTES
7
+ The contribution guide for the Project
8
+ #>
9
+ param (
10
+ # We can provide the repository url by hard-coding it,
11
+ # or it can be provided in site or page metadata.
12
+ # If we do not provide either, we can also look at the `$gitHubEvent`
13
+ [uri ]
14
+ $RepositoryUrl ,
15
+
16
+ # We can provide the path by hard-coding it, or it can provided in site or page metadata.
17
+ [string ]
18
+ $ContributingPath = ' ../CONTRIBUTING.md'
19
+ )
20
+
21
+ # Push into this location, in case we are building this file interactively.
22
+ if ($PSScriptRoot ) { Push-Location $PSScriptRoot }
23
+
24
+ if (-not $RepositoryUrl ) {
25
+ if ($gitHubEvent.repository.html_url ) {
26
+ $repositoryUrl = $gitHubEvent.repository.html_url -as [uri ]
27
+ } else {
28
+ return
29
+ }
30
+ }
31
+
32
+ # Get my own help
33
+ $myHelp = Get-Help $MyInvocation.MyCommand.ScriptBlock.File
34
+ if ($myHelp ) {
35
+ # If we have page metadata
36
+ if ($page -is [Collections.IDictionary ]) {
37
+ # Replace 'Project' in the title with the url, to make the title and description more helpful
38
+ $page.Title = $myHelp.SYNOPSIS -replace ' Project' , {
39
+ $RepositoryUrl.Segments [-1 ] -replace ' /'
40
+ }
41
+ $page.Description = $myHelp.Description.text -join [Environment ]::NewLine -replace ' The Project' , {
42
+ $RepositoryUrl.Segments [-1 ] -replace ' /'
43
+ }
44
+ }
45
+
46
+ # If we have notes, replace the project with our name
47
+ $myNotes = $myHelp.alertSet.alert.text -join [Environment ]::NewLine -replace ' The Project' , {
48
+ $RepositoryUrl.Segments [-1 ] -replace ' /'
49
+ }
50
+ if ($myNotes ) {
51
+ # and convert our notes from markdown.
52
+ (ConvertFrom-Markdown - InputObject $myNotes ).Html
53
+ }
54
+ }
55
+
56
+ if (Test-Path $ContributingPath ) {
57
+ ConvertFrom-Markdown - Path $ContributingPath |
58
+ Select-Object - ExpandProperty HTML
59
+ }
60
+
61
+ if ($PSScriptRoot ) { Pop-Location }
0 commit comments