Commit 4d83c75
🩹 [Patch]: Add OwnerUrl and RepositoryUrl properties to GitHubEnvironment class and enable hyperlinks in format display (#502)
## Changes Made
Added two new properties to the `GitHubEnvironment` class:
- `OwnerUrl` - URL to the owner/organization profile (e.g.,
`https://github.com/octocat`)
- `RepositoryUrl` - URL to the repository (e.g.,
`https://github.com/octocat/Hello-World`)
These properties are automatically populated in the constructor using
the existing `Context.HostName` pattern, ensuring compatibility with
both GitHub.com and GitHub Enterprise instances.
Updated the URL property comments to include examples following the same
format used in other classes:
- `OwnerUrl` - Example: `https://github.com/octocat`
- `RepositoryUrl` - Example: `https://github.com/octocat/Hello-World`
- `Url` - Example:
`https://github.com/octocat/Hello-World/settings/environments/123/edit`
Updated the `GitHubEnvironment.Format.ps1xml` file to add hyperlinks to
Owner and Repository columns when the host supports virtual terminal
(and not running in GitHub Actions), following the same pattern used in
other format files.
## Example Usage
```powershell
$environment = Get-GitHubEnvironment -Owner 'octocat' -Repository 'Hello-World' -Name 'production'
# New properties provide direct access to related URLs
Write-Host "Owner URL: $($environment.OwnerUrl)" # https://github.com/octocat
Write-Host "Repository URL: $($environment.RepositoryUrl)" # https://github.com/octocat/Hello-World
Write-Host "Environment URL: $($environment.Url)" # https://github.com/octocat/Hello-World/settings/environments/123/edit
```
Now when displaying GitHubEnvironment objects in a table format, the
Owner and Repository names will be clickable hyperlinks (when terminal
supports it) that navigate to their respective GitHub pages.
## Benefits
- **Consistency**: Follows the same URL pattern and documentation format
established by other classes like `GitHubRepository` and `GitHubOwner`
- **Enhanced UX**: Owner and Repository names are now clickable links in
terminal environments that support hyperlinks
- **Convenience**: Users no longer need to manually construct
organization or repository URLs
- **Enterprise Support**: Works seamlessly with custom GitHub Enterprise
hostnames
- **Non-breaking**: Purely additive changes that don't affect existing
functionality
Fixes #455.
<!-- START COPILOT CODING AGENT TIPS -->
---
đź’ˇ You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>1 parent fff966d commit 4d83c75
File tree
2 files changed
+27
-2
lines changed- src
- classes/public/Environment
- formats
2 files changed
+27
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
11 | 19 | | |
| 20 | + | |
12 | 21 | | |
13 | 22 | | |
14 | 23 | | |
| |||
34 | 43 | | |
35 | 44 | | |
36 | 45 | | |
| 46 | + | |
| 47 | + | |
37 | 48 | | |
38 | 49 | | |
39 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
36 | 43 | | |
37 | 44 | | |
38 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
39 | 53 | | |
40 | 54 | | |
41 | 55 | | |
| |||
0 commit comments