Skip to content

Commit f8a4e0a

Browse files
State repository index helper contracts directly
1 parent c4319be commit f8a4e0a

2 files changed

Lines changed: 52 additions & 56 deletions

File tree

‎.github/actions/update-index/action.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Update index
2-
description: Run repository index update script via GitHub-Script.
2+
description: Update the repository index through GitHub-Script.
33
inputs:
44
ClientID:
55
description: GitHub App client ID used by GitHub-Script.

‎.github/actions/update-index/src/Helper.psm1‎

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ param()
1010
function Connect-GitHubAppDefaultContext {
1111
<#
1212
.SYNOPSIS
13-
Ensures a default GitHub App context is active.
13+
Select a default GitHub App context.
1414
1515
.DESCRIPTION
16-
Uses Connect-GitHubApp with -Default so subsequent GitHub module calls
17-
use an authenticated default context instead of anonymous access.
16+
Connect-GitHubAppDefaultContext reuses the owner's default GitHub App context or connects with Connect-GitHubApp -Default.
1817
#>
1918
[CmdletBinding()]
2019
param(
@@ -39,11 +38,11 @@ function Connect-GitHubAppDefaultContext {
3938
function Show-RepoList {
4039
<#
4140
.SYNOPSIS
42-
Displays a formatted list of repositories for a GitHub organization.
41+
Show the repositories for a GitHub organization.
4342
4443
.DESCRIPTION
45-
Connects to the specified GitHub organization, retrieves all repositories with their
46-
descriptions and custom Type property, then outputs a sorted table grouped by type and name.
44+
Show-RepoList gets repositories with their descriptions and custom Type property.
45+
It sorts them by type and name, displays a table, and returns the repository objects.
4746
4847
.EXAMPLE
4948
Show-RepoList
@@ -101,12 +100,12 @@ function Show-RepoList {
101100
function Update-MDSection {
102101
<#
103102
.SYNOPSIS
104-
Updates a specific section within a markdown file.
103+
Update a named section in a Markdown file.
105104
106105
.DESCRIPTION
107-
This function searches for a named section within a markdown file, identified by special comment markers.
108-
It replaces the content between the markers with the provided new content. If the markers are not found,
109-
an error is thrown. The function supports `-WhatIf` and `-Confirm` parameters for safety.
106+
Update-MDSection replaces the content between the named comment markers.
107+
If a marker is missing, the function throws an error.
108+
It supports the `-WhatIf` and `-Confirm` parameters.
110109
111110
.EXAMPLE
112111
Update-MDSection -Path '.\profile\README.md' -Name 'MODULE_LIST' -Content 'New module list'
@@ -121,15 +120,15 @@ function Update-MDSection {
121120
[outputType([void])]
122121
[CmdletBinding(SupportsShouldProcess)]
123122
param(
124-
# Path to the markdown file where the section should be updated.
123+
# Path to the Markdown file to update.
125124
[Parameter()]
126125
[string] $Path = 'src\docs\index.md',
127126

128-
# Name of the section to be updated, used in comment markers.
127+
# Section name in the comment markers.
129128
[Parameter()]
130129
[string] $Name = 'MODULE_LIST',
131130

132-
# The new content to insert between the section markers.
131+
# Content to insert between the section markers.
133132
[Parameter()]
134133
[string] $Content
135134
)
@@ -163,10 +162,10 @@ function Update-MDSection {
163162
function Get-TemplateContent {
164163
<#
165164
.SYNOPSIS
166-
Reads a template file as raw text.
165+
Read a template file as text.
167166
168167
.DESCRIPTION
169-
Loads a UTF-8 template file from disk and returns the complete content as a string.
168+
Get-TemplateContent reads a UTF-8 template file and returns its full content as a string.
170169
#>
171170
[OutputType([string])]
172171
[CmdletBinding()]
@@ -181,11 +180,12 @@ function Get-TemplateContent {
181180
function Get-PropertyValue {
182181
<#
183182
.SYNOPSIS
184-
Gets the first non-empty property value from an object.
183+
Get the first property value that is not empty.
185184
186185
.DESCRIPTION
187-
Evaluates the provided property names in order and returns the first property
188-
value that exists and is not null/whitespace. Returns the default value otherwise.
186+
Get-PropertyValue reads the named properties in order.
187+
It returns the first value that is not null or whitespace.
188+
If no value qualifies, it returns the default value.
189189
#>
190190
[OutputType([object])]
191191
[CmdletBinding()]
@@ -221,12 +221,12 @@ function Get-PropertyValue {
221221
function Invoke-GitHubApi {
222222
<#
223223
.SYNOPSIS
224-
Invokes a GitHub REST API GET request.
224+
Send a GET request to the GitHub REST API.
225225
226226
.DESCRIPTION
227-
Calls the GitHub module API wrapper, ensures a default GitHub App context
228-
for authenticated requests (unless -Anonymous is used), normalizes wrapped
229-
responses, and treats HTTP 404 as missing data.
227+
Invoke-GitHubApi calls the GitHub module API wrapper and unwraps its response.
228+
HTTP 404 returns no data.
229+
With -Anonymous, the request uses anonymous access.
230230
#>
231231
[OutputType([object])]
232232
[CmdletBinding()]
@@ -308,11 +308,10 @@ function Invoke-GitHubApi {
308308
function Get-RepositoryReadmeContent {
309309
<#
310310
.SYNOPSIS
311-
Gets a repository README as plain text.
311+
Get a repository README as text.
312312
313313
.DESCRIPTION
314-
Downloads the repository README from GitHub and decodes the returned
315-
Base64 content to UTF-8 text.
314+
Get-RepositoryReadmeContent downloads the repository README from GitHub and decodes the Base64 content to UTF-8 text.
316315
#>
317316
[OutputType([string])]
318317
[CmdletBinding()]
@@ -341,11 +340,10 @@ function Get-RepositoryReadmeContent {
341340
function Get-MarkdownSummary {
342341
<#
343342
.SYNOPSIS
344-
Extracts a short summary from markdown content.
343+
Get a short summary from Markdown content.
345344
346345
.DESCRIPTION
347-
Removes common markdown formatting and returns the first non-empty paragraph,
348-
suitable for compact previews.
346+
Get-MarkdownSummary removes common Markdown formatting and returns the first paragraph that is not empty.
349347
#>
350348
[OutputType([string])]
351349
[CmdletBinding()]
@@ -380,11 +378,11 @@ function Get-MarkdownSummary {
380378
function ConvertTo-HtmlAttributeValue {
381379
<#
382380
.SYNOPSIS
383-
Converts text to a safe HTML attribute preview value.
381+
Convert text to an HTML attribute value.
384382
385383
.DESCRIPTION
386-
Normalizes whitespace, truncates to a max length, and escapes special HTML
387-
characters for use in attributes such as title.
384+
ConvertTo-HtmlAttributeValue normalizes whitespace and limits the text length.
385+
It escapes special HTML characters for attributes such as title.
388386
#>
389387
[OutputType([string])]
390388
[CmdletBinding()]
@@ -414,11 +412,11 @@ function ConvertTo-HtmlAttributeValue {
414412
function Get-OpenItemCount {
415413
<#
416414
.SYNOPSIS
417-
Gets the open issue or pull request count for a repository.
415+
Get the number of open issues or pull requests in a repository.
418416
419417
.DESCRIPTION
420-
Uses GitHub search API with a repository/type/state query and returns
421-
the total count.
418+
Get-OpenItemCount queries the GitHub search API by repository, type, and state.
419+
It returns the total count.
422420
#>
423421
[OutputType([int])]
424422
[CmdletBinding()]
@@ -445,11 +443,11 @@ function Get-OpenItemCount {
445443
function Get-RepositoryVersion {
446444
<#
447445
.SYNOPSIS
448-
Gets a repository's latest version identifier.
446+
Get a repository's latest version identifier.
449447
450448
.DESCRIPTION
451-
Returns the latest release tag/name when available, otherwise falls back
452-
to the most recent tag, or N/A.
449+
Get-RepositoryVersion returns the latest release tag or name.
450+
If no release is available, it returns the first repository tag, or N/A if no tag exists.
453451
#>
454452
[OutputType([string])]
455453
[CmdletBinding()]
@@ -481,11 +479,11 @@ function Get-RepositoryVersion {
481479
function Get-WorkflowReference {
482480
<#
483481
.SYNOPSIS
484-
Gets the Process-PSModule workflow reference used by a repository.
482+
Get a repository's Process-PSModule workflow reference.
485483
486484
.DESCRIPTION
487-
Scans common workflow entry files on the default branch and extracts the
488-
`@ref` from `uses: PSModule/Process-PSModule/...@ref` if present.
485+
Get-WorkflowReference reads workflow files on the default branch.
486+
It extracts `@ref` from `uses: PSModule/Process-PSModule/...@ref` when present.
489487
#>
490488
[OutputType([string])]
491489
[CmdletBinding()]
@@ -649,11 +647,10 @@ function Get-WorkflowReference {
649647
function Get-ProcessReferenceStatus {
650648
<#
651649
.SYNOPSIS
652-
Computes status of a Process-PSModule workflow reference.
650+
Determine the status of a Process-PSModule workflow reference.
653651
654652
.DESCRIPTION
655-
Classifies a workflow reference value relative to the latest available
656-
Process-PSModule version.
653+
Get-ProcessReferenceStatus compares the reference with the latest available Process-PSModule version.
657654
#>
658655
[OutputType([string])]
659656
[CmdletBinding()]
@@ -699,11 +696,10 @@ function Get-ProcessReferenceStatus {
699696
function New-ModuleCatalogPage {
700697
<#
701698
.SYNOPSIS
702-
Creates or updates a generated module catalog page.
699+
Create or update a generated module catalog page.
703700
704701
.DESCRIPTION
705-
Builds markdown content from module metadata and writes it to the
706-
target page path.
702+
New-ModuleCatalogPage builds Markdown content from module metadata and writes it to the target page.
707703
#>
708704
[CmdletBinding(SupportsShouldProcess)]
709705
param(
@@ -743,11 +739,11 @@ $($ModuleData.About)
743739
function Update-ActionList {
744740
<#
745741
.SYNOPSIS
746-
Updates the GitHub Actions list section in the documentation.
742+
Update the GitHub Actions list in the documentation.
747743
748744
.DESCRIPTION
749-
Generates an HTML table of all GitHub Actions repositories from the module's repo list
750-
and updates the ACTION_LIST section in the GitHub Actions index markdown file.
745+
Update-ActionList builds an HTML table from GitHub Actions repositories in the repository list.
746+
It updates the ACTION_LIST section in the GitHub Actions index Markdown file.
751747
752748
.EXAMPLE
753749
Update-ActionList
@@ -802,11 +798,11 @@ $actionTableRows</table>
802798
function Update-ModuleList {
803799
<#
804800
.SYNOPSIS
805-
Updates the PowerShell modules list section in the documentation.
801+
Update the PowerShell module catalog in the documentation.
806802
807803
.DESCRIPTION
808-
Generates an enriched HTML table for PSModule module repositories and writes
809-
repository-specific catalog pages that summarize README and module metadata.
804+
Update-ModuleList builds an HTML table for PSModule module repositories.
805+
It writes a catalog page for each repository with a README summary and module metadata.
810806
#>
811807
[CmdletBinding(SupportsShouldProcess)]
812808
param(
@@ -929,11 +925,11 @@ function Update-ModuleList {
929925
function Update-FunctionAppList {
930926
<#
931927
.SYNOPSIS
932-
Updates the Azure Function Apps list section in the documentation.
928+
Update the Azure Function Apps list in the documentation.
933929
934930
.DESCRIPTION
935-
Generates an HTML table of all Azure Function App repositories from the module's repo list
936-
and updates the FUNCTIONAPP_LIST section in the PowerShell FunctionApps index markdown file.
931+
Update-FunctionAppList builds an HTML table from Azure Function App repositories in the repository list.
932+
It updates the FUNCTIONAPP_LIST section in the PowerShell FunctionApps index Markdown file.
937933
938934
.EXAMPLE
939935
Update-FunctionAppList

0 commit comments

Comments
 (0)