Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 [Feature]: GitHub App creation and installation management #281

Merged
merged 76 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
19d5801
Fix App installations
MariusStorhaug Jan 23, 2025
cda6444
Move GitHubAppJWT to GitHub Apps
MariusStorhaug Jan 23, 2025
5466543
Merge branch 'main' of https://github.com/PSModule/GitHub into AppIns…
MariusStorhaug Jan 24, 2025
b02e0bb
Move GitHub App installation and uninstallation functions to private …
MariusStorhaug Jan 24, 2025
9764809
Add repository selection parameters to Install-GitHubApp function
MariusStorhaug Jan 24, 2025
1f6f7dc
Merge branch 'main' of https://github.com/PSModule/GitHub into AppIns…
MariusStorhaug Jan 26, 2025
6d4b295
🪲 [Fix]: Update context parameters for GitHub installation types and …
MariusStorhaug Jan 26, 2025
cfb6481
🪲 [Fix]: Remove default context assignment
MariusStorhaug Jan 26, 2025
c4a1f23
tests
MariusStorhaug Jan 26, 2025
6329abf
Revert Organization to Owner
MariusStorhaug Jan 27, 2025
aacdbe3
Remove dynamicparam that requires context
MariusStorhaug Jan 27, 2025
42c4e6a
🪲 [Refactor]: Rename InstallationID parameter to ID and update relate…
MariusStorhaug Jan 27, 2025
60e4cb9
🪲 [Refactor]: Update alias for InstallationID parameter to improve co…
MariusStorhaug Jan 27, 2025
0df943a
Gather all GitHubAppInstallation functiuns under Get-GitHubAppInstall…
MariusStorhaug Jan 27, 2025
c28d6d9
🪲 [Refactor]: Update output to return full API response instead of ju…
MariusStorhaug Jan 28, 2025
bd34586
🪲 [Refactor]: Clean up parameter definitions and streamline API reque…
MariusStorhaug Jan 29, 2025
3e906aa
Fix PerPage param
MariusStorhaug Jan 29, 2025
106ac22
Fix get
MariusStorhaug Jan 29, 2025
73cc337
Fix command for GetRepoAccess
MariusStorhaug Jan 29, 2025
581ec05
Playing around with parallelism -> sequentialism :)
MariusStorhaug Jan 29, 2025
fdef7c5
🪲 [Refactor]: Improve installation filtering and update verbose loggi…
MariusStorhaug Jan 29, 2025
2bd74b0
Fix parallelism
MariusStorhaug Jan 29, 2025
b7a0a59
🪲 [Refactor]: Enhance parameter handling and improve installation fil…
MariusStorhaug Jan 29, 2025
eabbbbc
🪲 [Refactor]: Update verbose logging for user, organization, and ente…
MariusStorhaug Jan 29, 2025
e78df97
🪲 [Refactor]: Add Silent parameter to suppress output in Connect-GitH…
MariusStorhaug Jan 29, 2025
7585b3c
🪲 [Refactor]: Update module requirements in various scripts for consi…
MariusStorhaug Feb 2, 2025
e14961b
Merge branch 'main' of https://github.com/PSModule/GitHub into AppIns…
MariusStorhaug Feb 3, 2025
3342b10
📝 [Documentation]: Add guidelines for function and parameter naming c…
MariusStorhaug Feb 3, 2025
8276211
🩹 [Patch]: Update parameter name from `TokenType` to `AuthType` in `A…
MariusStorhaug Feb 3, 2025
85ab67e
🩹 [Refactor]: Rename action scripts and update parameter names for co…
MariusStorhaug Feb 3, 2025
06e5877
🩹 [Refactor]: Rename GitHub Apps scripts and update parameter names f…
MariusStorhaug Feb 3, 2025
711ee57
🩹 [Refactor]: Simplify API call structures and improve parameter hand…
MariusStorhaug Feb 3, 2025
ce3273f
🩹 [Refactor]: Update parameter type for `$Context` to `GitHubContext`…
MariusStorhaug Feb 3, 2025
8d15f5e
🩹 [Refactor]: Update parameter type for `$Context` to `GitHubContext`…
MariusStorhaug Feb 3, 2025
914da11
🩹 [Refactor]: Enhance parameter handling and add TODOs for permission…
MariusStorhaug Feb 3, 2025
015915f
🩹 [Refactor]: Update parameter type for `$Context` to `GitHubContext`…
MariusStorhaug Feb 3, 2025
9731ff8
🩹 [Refactor]: Update parameter type for `$Context` to `GitHubContext`…
MariusStorhaug Feb 3, 2025
6371d20
🩹 [Refactor]: Update parameter type for `$Context` to `GitHubContext`…
MariusStorhaug Feb 3, 2025
4f9ce61
🩹 [Refactor]: Standardize HTTP method casing and enforce mandatory co…
MariusStorhaug Feb 3, 2025
ff2246d
🩹 [Refactor]: Enforce mandatory parameter for `$Enterprise` and stand…
MariusStorhaug Feb 3, 2025
1b2652e
[Refactor]: Rename `$Repo` parameter to `$Repository` for consistency…
MariusStorhaug Feb 4, 2025
e6d78f2
🩹 [Refactor]: Rename `$Repo` parameter to `$Repository` in test cases…
MariusStorhaug Feb 4, 2025
fb3d97e
🩹 [Refactor]: Remove default parameter set name in CmdletBinding for …
MariusStorhaug Feb 4, 2025
89c1a29
🩹 [Refactor]: Remove 'SkipTests' parameter from GitHub Actions workfl…
MariusStorhaug Feb 4, 2025
a823176
🩹 [Refactor]: Add debug output for parameter set handling in Get-GitH…
MariusStorhaug Feb 4, 2025
4933806
🩹 [Refactor]: Remove unnecessary comment from Update-GitHubUserAccess…
MariusStorhaug Feb 4, 2025
33d75da
🩹 [Refactor]: Update comment formatting for clarity in Get-GitHubMark…
MariusStorhaug Feb 4, 2025
f7c7a4c
🩹 [Refactor]: Update guideline headers to use proper PowerShell docum…
MariusStorhaug Feb 4, 2025
93fdc9e
Merge branch 'main' of https://github.com/PSModule/GitHub into AppIns…
MariusStorhaug Feb 4, 2025
ad72862
🩹 [Patch]: Enable Debug and Verbose output in Process-PSModule workflow
MariusStorhaug Feb 4, 2025
13547e0
🩹 [Patch]: Remove unnecessary comment from Update-GitHubUserAccessTok…
MariusStorhaug Feb 4, 2025
6c3a8cf
🩹 [Patch]: Make `$Context` parameter mandatory and update API call st…
MariusStorhaug Feb 4, 2025
2b63786
🩹 [Patch]: Make `$Context` parameter optional and change its type to …
MariusStorhaug Feb 4, 2025
d1cc8f4
🩹 [Patch]: Make `$Context` parameter mandatory in multiple functions …
MariusStorhaug Feb 4, 2025
89cd783
🩹 [Patch]: Make `$Context` parameter mandatory in multiple repository…
MariusStorhaug Feb 4, 2025
ef2fc8c
🩹 [Patch]: Make `$Context` parameter mandatory in multiple user and t…
MariusStorhaug Feb 4, 2025
2114b9d
🩹 [Patch]: Update `$Context` parameter type to `GitHubContext` and ma…
MariusStorhaug Feb 4, 2025
f066cab
🩹 [Patch]: Fix context type casting in Set-GitHubContext function and…
MariusStorhaug Feb 4, 2025
fc6b201
🩹 [Patch]: Update Set-GitHubContext to handle IAT authentication type…
MariusStorhaug Feb 4, 2025
d5a21b9
🩹 [Patch]: Change `$Context` parameter type from `GitHubContext` to `…
MariusStorhaug Feb 4, 2025
34ac1ee
🩹 [Patch]: Correct formatting and style guidelines in Guidelines.md
MariusStorhaug Feb 4, 2025
73cc340
🩹 [Patch]: Rename Repo parameter to Repository for clarity in GitHubC…
MariusStorhaug Feb 4, 2025
b5ed26d
🩹 [Patch]: Update CmdletBinding in Get-GitHubContext and simplify ali…
MariusStorhaug Feb 4, 2025
5985748
🩹 [Patch]: Update Get-GitHubApp to use 'Name' parameter instead of 'A…
MariusStorhaug Feb 4, 2025
80891ba
🩹 [Patch]: Update CmdletBinding in multiple functions to set default …
MariusStorhaug Feb 5, 2025
6b3ca28
🩹 [Patch]: Add module requirement for 'Context' in Update-GitHubUserA…
MariusStorhaug Feb 5, 2025
7e973bb
🩹 [Patch]: Rename 'Destination' parameter to 'Path' in Get-GitHubEmoj…
MariusStorhaug Feb 5, 2025
1e1a445
🩹 [Patch]: Update examples and tests to replace 'Destination' paramet…
MariusStorhaug Feb 5, 2025
f52d910
🩹 [Patch]: Update tests to replace usage of 'guid' variable with stat…
MariusStorhaug Feb 5, 2025
96bf7f9
🩹 [Patch]: Simplify error handling in multiple functions by removing …
MariusStorhaug Feb 5, 2025
cd26867
🩹 [Patch]: Simplify error handling by removing try-catch blocks in mu…
MariusStorhaug Feb 5, 2025
37d9921
Alias cleanup
MariusStorhaug Feb 5, 2025
c82fcdc
🩹 [Patch]: Refactor Get-GitHubGitConfig function for improved readabi…
MariusStorhaug Feb 5, 2025
190efad
🩹 [Patch]: Remove debug and verbose flags from GitHub app installatio…
MariusStorhaug Feb 5, 2025
b723508
🩹 [Patch]: Standardize HTTP method casing in API calls across multipl…
MariusStorhaug Feb 5, 2025
ad26ea2
🩹 [Patch]: Update CodingStandard.md to clarify coding standards and e…
MariusStorhaug Feb 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 186 additions & 0 deletions CodingStandard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Coding Standards for `GitHub`

Start by reading the general coding standards for [`PSModule`](https://psmodule.io/docs) which is the basis for all modules in the framework.
Additions or adjustments to those defaults are covered in this document to ensure that the modules drive consistancy for all developers.

## General Coding Standards

1. **PowerShell Keywords**
- All PowerShell keywords (e.g. `if`, `return`, `throw`, `function`, `param`) **must** be in lowercase.

2. **Brace Style**
- Use **One True Bracing Style (OTBS)**.
- Opening brace on the same line as the statement; closing brace on its own line.

3. **Coverage**
- We do **not** need 100% coverage of the GitHub API.
- Maintain a separate file listing the endpoints you intentionally **do not** cover, so the coverage report can mark them accordingly (e.g., ⚠️).

4. **Convert Filter Types**
- Wherever filters are used, ensure they are implemented as standard PowerShell functions with `begin`, `process`, and `end` blocks.

---

## Functions

- **Grouping**
- Group functions by the *object type* they handle, using folders named for that object type (e.g. “Repository”), **not** by the API endpoint URL.

- **Naming**
- Public function name format: **`Verb-GitHubNoun`**.
- Private function name format: **`Verb-GitHubNoun`** (same style but no aliases).
- **`Get-`** functions must **not** include `[CmdletBinding(SupportsShouldProcess)]`. You only use `SupportsShouldProcess` on commands that change or remove data (`Set-`, `Remove-`, `Add-`, etc.).

- **Default Parameter Sets**
- Do **not** declare `DefaultParameterSetName = '__AllParameterSets'`.
- Only specify a `DefaultParameterSetName` if it is actually different from the first parameter set.

- **One API Call = One Function**
- If you find that a single function is handling multiple distinct API calls, split it into multiple functions.

- **Public vs. Private**
1. **Public Functions**
- Support pipeline input if appropriate.
- Should begin by calling `Resolve-GitHubContext` to handle the `Context` parameter, which can be either a string or a `GitHubContext` object.
- Use parameter sets (with `begin`, `process`, `end`) if you have multiple ways to call the same logical operation.
- If choosing among multiple underlying private functions, use a `switch` statement in the `process` block keyed on the parameter set name.
- If a parameter like `$Repository` is missing, you can default to `$Context.Repo`. If no value is found, **throw** an error.
2. **Private Functions**
- **No pipeline input**.
- No aliases on either the function or its parameters.
- **`Context` is mandatory** (type `GitHubContext`), since public functions should already have resolved it.
- **`Owner`, `Organization`, `ID`, `Repository`** are also mandatory if required by the endpoint.
- Must not contain logic to default parameters from `Context`; that is resolved in public functions.

---

## Documentation for Functions

All function documentation follows standard PowerShell help conventions, with some notes:

1. **.SYNOPSIS**, **.DESCRIPTION**, **.EXAMPLES**
- Examples in your code should include fencing (e.g., triple backticks) because the PSModule framework removes default fences.

2. **.PARAMETER**
- Do **not** store parameter documentation in a comment block separate from the parameter. Instead, use inline parameter documentation via the `[Parameter()]` attribute and descriptions in triple-slash (`///`) comments above each parameter.

3. **.NOTES**
- Include a link to the official documentation (if any) that the function is based on, so it’s discoverable via online help.

4. **.LINK**
- First link should be the function’s own local documentation (generated for the PowerShell module).
- Additional links can point to official GitHub or API documentation.

---

## Parameter Guidelines

1. **Always Declare [Parameter()]**
- Every parameter must explicitly have a `[Parameter()]` attribute, even if empty.
- Place these attributes in a consistent order (see **Parameter Attributes Order** below).

2. **Parameter Types**
- Always specify a type, e.g. `[string] $Owner` (rather than `$Owner` alone).

3. **Parameter Naming**
- Use **PascalCase** for parameters.
- Convert snake_case from the API docs to **PascalCase** in the function.
- **`ID`** should be the short name. If needed, add an alias for a long form (e.g., `[Alias('SomeLongName')]`) or for a different style (`'id'`, `'Id'`), depending on user expectations.
- If the function name implies the object (e.g., `Get-GitHubRepository`), do **not** name the parameter `RepositoryId`. Just `ID` (or `Name`, etc.) suffices. Keep it object-oriented rather than repeating the context.
- `Owner` should always have the aliases: `Organization` and `User`.
- `Username` can have the alias `Login` if relevant for a particular API.
- Use `Repository` (not `Repo`). If you need an alias for backward compatibility, add `[Alias('Repo')]`.

4. **Parameter Attribute Order**
1. `[Parameter()]`
2. `[ValidateNotNullOrEmpty()]` or other validation attributes
3. `[Alias()]` if any
4. Then the parameter definition itself: `[string] $ParamName`

5. **Parameter Defaulting**
- For **public** functions, if the user hasn’t provided a parameter (like `$Repository`), default it from the context:
```powershell
if (-not $Repository) {
$Repository = $Context.Repo
}
if (-not $Repository) {
throw "Repository not specified and not found in the context."
}
```
- For **private** functions, the calling function should already have done this. Private functions assume mandatory parameters.

6. **Remove `[org]` Alias**
- Do not use `[Alias('org')]` on the `$Organization` parameter. Use `[Alias('User','Organization')]` on `$Owner` instead.

---

## Function Content & Flow

1. **Structure**
- Always use `begin`, `process`, and `end` blocks.
- **`begin`**: Validate parameters, call `Assert-GitHubContext` if needed, set up any local state.
- Add a comment stating which permissions are required for the API call.
- **`process`**: Main logic, including pipeline handling if public.
- **`end`**: Cleanup if necessary.

2. **ShouldProcess**
- Only use `[CmdletBinding(SupportsShouldProcess)]` for commands that create, update, or remove data. **Do not** apply it to `Get-` commands.

3. **API Method Naming**
- Use PascalCase for the method in your splat (e.g., `Post`, `Delete`, `Put`, `Get`).
- The `Method` property in your hashtable to `Invoke-GitHubAPI` (or other REST calls) should reflect that standard.

4. **Splatting**
- Always splat the API call. The standard order in the splat is:
1. `Method`
2. `APIEndpoint` (or `Endpoint`, with `APIEndpoint` as an alias if necessary)
3. `Body`
4. `Context`
- Body is always a hashtable containing the payload for `POST`, `PATCH`, or `PUT` calls.

5. **Removing String Checks**
- Do **not** use `if ([string]::IsNullOrEmpty($Param))`. Instead, check `-not $Param` or rely on `[ValidateNotNullOrEmpty()]`.

6. **Pipeline Output**
- After calling `Invoke-GitHubAPI @inputObject`, you can **either**:
- `ForEach-Object { Write-Output $_.Response }`
- or `Select-Object -ExpandProperty Response`
- Choose which pattern best fits your scenario, but be consistent within a function.

---

## Classes

1. **One Class per Resource**
- Each distinct resource type gets its own `.ps1` or `.psm1` with a single class definition.

2. **Property and Method Naming**
- Use PascalCase for all public properties and methods.

3. **Return Types / Interfaces**
- Each class that you return should have a consistent interface.
- Remove any properties that are purely “API wrapper” fields (e.g., raw HTTP artifacts that aren’t relevant to the user).

---

## Additional Notes

1. **Endpoint Coverage File**
- Maintain a list of endpoints you’re deliberately **not** implementing, so that your coverage reporting can include a ⚠️ for them.

2. **Parameter Name Design**
- Use object-oriented naming that reflects the entity. For example, if the function is `Remove-GitHubRepository`, simply use `-ID` (or `-Name`) rather than `-RepositoryID`.

3. **Aliases**
- Private functions have **no** aliases (function-level or parameter-level).
- Public functions can add aliases where it makes sense (`Owner` has `-User`/`-Organization`, `Repository` might have `-Repo` alias if needed, `Username` might have `-Login`).

4. **Mandatory Context for Private**
- Private functions must always expect a resolved `[GitHubContext] $Context`. Public functions handle any string-based or null context resolution logic.

5. **We Do Not Have to Cover Every Possible API**
- Some endpoints (e.g., “hovercards” or other rarely used features) can be excluded.

---

That’s it. This spec captures all the bullet points and original guidelines in one place. Use it as the authoritative reference for coding style, function naming, parameter declarations, and general best practices in your module.
2 changes: 1 addition & 1 deletion examples/Apps/AppManagement.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$appIDs = @(
'Iv1.f26b61bc99e69405'
)
$orgs = Get-GitHubEnterpriseInstallableOrganization -Enterprise 'msx'
$orgs = Get-GitHubAppInstallableOrganization -Enterprise 'msx'
foreach ($org in $orgs) {
foreach ($appID in $appIDs) {
Install-GitHubAppOnEnterpriseOrganization -Enterprise msx -Organization $org.login -ClientID $appID -RepositorySelection all
Expand Down
12 changes: 2 additions & 10 deletions examples/Apps/EnterpriseApps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ filter Install-GithubApp {
[string] $AppID
)

begin {

}

process {
$installableOrgs = Get-GitHubEnterpriseInstallableOrganization -Enterprise $Enterprise -Debug -Verbose
$installableOrgs = Get-GitHubAppInstallableOrganization -Enterprise $Enterprise -Debug -Verbose
$orgs = $installableOrgs | Where-Object { $_.login -like $organization }
foreach ($org in $orgs) {
foreach ($appIDitem in $AppID) {
Expand All @@ -37,12 +33,8 @@ filter Install-GithubApp {
}
}
}

end {

}
}

$appIDs | Install-GithubApp -Organization $organization -Debug -Verbose
$appIDs | Install-GitHubApp -Organization $organization -Debug -Verbose

$installation = Get-GitHubAppInstallation
5 changes: 4 additions & 1 deletion examples/Connecting.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
###
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
#Requires -Modules @{ ModuleName = 'Microsoft.PowerShell.SecretManagement'; RequiredVersion = '1.1.2' }

###
### CONNECTING
###

Expand Down
1 change: 0 additions & 1 deletion examples/Teams/Get-AllTeams.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion scripts/Update-CoverageReport.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Requires -Modules MarkdownPS
#Requires -Modules @{ ModuleName = 'MarkdownPS'; RequiredVersion = '1.10' }

[CmdletBinding()]
param()
Expand Down
2 changes: 1 addition & 1 deletion src/classes/public/Config/GitHubConfig.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# The default value for the HTTP protocol version.
[string] $HttpVersion

# The default value for the 'per_page' API parameter used in 'Get' functions that support paging.
# The default value for the 'per_page' API parameter used in 'GET' functions that support paging.
[int] $PerPage

# Simple parameterless constructor
Expand Down
6 changes: 3 additions & 3 deletions src/classes/public/Context/GitHubContext.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@
# The default value for the Owner parameter.
[string] $Owner

# The default value for the Repo parameter.
[string] $Repo
# The default value for the Repository parameter.
[string] $Repository

# The default value for the HTTP protocol version.
[string] $HttpVersion

# The default value for the 'per_page' API parameter used in 'Get' functions that support paging.
# The default value for the 'per_page' API parameter used in 'GET' functions that support paging.
[int] $PerPage

# Simple parameterless constructor
Expand Down
67 changes: 26 additions & 41 deletions src/functions/private/Actions/Get-GitHubWorkflowRunByRepo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@
`created`, `event`, `head_sha`, `status`.

.EXAMPLE
Get-GitHubWorkflowRunByRepo -Owner 'owner' -Repo 'repo'
Get-GitHubWorkflowRunByRepo -Owner 'owner' -Repository 'repo'

Lists all workflow runs for a repository.

.EXAMPLE
Get-GitHubWorkflowRunByRepo -Owner 'owner' -Repo 'repo' -Actor 'octocat' -Branch 'main' -Event 'push' -Status 'success'
Get-GitHubWorkflowRunByRepo -Owner 'owner' -Repository 'repo' -Actor 'octocat' -Branch 'main' -Event 'push' -Status 'success'

Lists all workflow runs for a repository with the specified actor, branch, event, and status.

.NOTES
[List workflow runs for a repository](https://docs.github.com/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository)
#>
[CmdletBinding(DefaultParameterSetName = 'Repo')]
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidLongLines', '', Justification = 'Contains a long link.')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidAssignmentToAutomaticVariable', 'Event',
Justification = 'A parameter that is used in the api call.')]
Expand All @@ -35,7 +35,7 @@

# The name of the repository. The name is not case sensitive.
[Parameter(Mandatory)]
[string] $Repo,
[string] $Repository,

# Returns someone's workflow runs. Use the login for the user who created the push associated with the check suite or workflow run.
[Parameter()]
Expand Down Expand Up @@ -82,53 +82,38 @@
[int] $PerPage,

# The context to run the command in. Used to get the details for the API call.
# Can be either a string or a GitHubContext object.
[Parameter()]
[object] $Context = (Get-GitHubContext)
[Parameter(Mandatory)]
[object] $Context
)

begin {
$stackPath = Get-PSCallStackPath
Write-Debug "[$stackPath] - Start"
$Context = Resolve-GitHubContext -Context $Context
Assert-GitHubContext -Context $Context -AuthType IAT, PAT, UAT
if ([string]::IsNullOrEmpty($Owner)) {
$Owner = $Context.Owner
}

process {
$body = @{
actor = $Actor
branch = $Branch
event = $Event
status = $Status
created = $Created
exclude_pull_requests = $ExcludePullRequests
check_suite_id = $CheckSuiteID
head_sha = $HeadSHA
per_page = $PerPage
}
Write-Debug "Owner: [$Owner]"

if ([string]::IsNullOrEmpty($Repo)) {
$Repo = $Context.Repo
$inputObject = @{
Method = 'GET'
APIEndpoint = "/repos/$Owner/$Repository/actions/runs"
Body = $body
Context = $Context
}
Write-Debug "Repo: [$Repo]"
}

process {
try {
$body = @{
actor = $Actor
branch = $Branch
event = $Event
status = $Status
created = $Created
exclude_pull_requests = $ExcludePullRequests
check_suite_id = $CheckSuiteID
head_sha = $HeadSHA
per_page = $PerPage
}

$inputObject = @{
Context = $Context
APIEndpoint = "/repos/$Owner/$Repo/actions/runs"
Method = 'GET'
Body = $body
}

Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response.workflow_runs
}
} catch {
throw $_
Invoke-GitHubAPI @inputObject | ForEach-Object {
Write-Output $_.Response.workflow_runs
}
}

Expand Down
Loading
Loading