Skip to content

Commit 351f272

Browse files
igoravlCopilotCopilotdependabot[bot]
authored
Add Personal Access Token management and Oh-My-Posh integration (#262)
* Add support for Oh-My-Posh prompt customization and environment variable synchronization * Add cmdlets for managing Personal Access Tokens (PATs) and implement confirmation patterns - Introduced RemovePersonalAccessToken cmdlet for revoking PATs, supporting admin and self-revocation scenarios. - Added SetPersonalAccessToken cmdlet to edit properties of existing PATs without regenerating them. - Implemented UpdatePersonalAccessToken cmdlet to regenerate PATs, preserving or overriding properties. - Created ITokenAdminHttpClient and ITokensHttpClient interfaces for token management. - Documented ShouldProcess and ShouldContinue guidelines for cmdlet confirmation support. - Added comprehensive architecture documentation for the TfsCmdlets project. * Update CSharp/TfsCmdlets/Cmdlets/Identity/PersonalAccessToken/RemovePersonalAccessToken.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix RELEASENOTES.md: replace -AsAdmin with -User parameter description for PAT cmdlets Agent-Logs-Url: https://github.com/igoravl/TfsCmdlets/sessions/164820b0-9985-4925-a619-1afcecaf647d Co-authored-by: igoravl <725797+igoravl@users.noreply.github.com> * Update Docs/ARCHITECTURE.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Docs/ARCHITECTURE.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Enhance ShouldContinue method to check for interactive mode before prompting * Fix build error, project SessionToken to PatToken in admin path, fix AGENTS.md controller guidance Agent-Logs-Url: https://github.com/igoravl/TfsCmdlets/sessions/65725977-f624-46f4-9f02-d76da0245657 Co-authored-by: igoravl <725797+igoravl@users.noreply.github.com> * Update CSharp/TfsCmdlets/Cmdlets/Shell/EnterShell.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update Docs/ARCHITECTURE.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix GetPersonalAccessToken returning nothing; fix ARCHITECTURE.md Controllers path - Pass null for optional API filters (DisplayFilter/SortBy/IsSortAscending) when user didn't explicitly provide them, so the API uses its server-side defaults instead of potentially invalid C# enum defaults (e.g. SortByOptions=0) - Add null-safety for result.PatTokens in ListPats loop - Update unit test to use nullable type matchers (Arg.Any<DisplayFilterOptions?>() etc.) - Fix ARCHITECTURE.md project tree: remove non-existent Controllers/ dir under TfsCmdlets/, move ControllerBase.cs into Cmdlets/, correct TfsCmdlets.Legacy/ layout Agent-Logs-Url: https://github.com/igoravl/TfsCmdlets/sessions/dc0900e8-42a9-43a0-bfed-f1a6e568991c Co-authored-by: igoravl <725797+igoravl@users.noreply.github.com> * Refactor EnterShell parameters and integrate Oh-My-Posh theme configuration * Add PAT Scope argument completer for TFS Personal Access Token commands * Refactor GetPersonalAccessToken parameters for clarity and consistency * Enhance NewPersonalAccessToken to support multiple scopes and default expiration * Add guidelines for using extension methods and formatting output in AGENTS.md * Update release notes for version 2.11.0 to reflect changes in Enter-TfsShell integration and environment variable controls * Add documentation for the `Items` pattern in mutation controllers * Add aliases for PersonalAccessToken parameters to support "Pat" in cmdlets * Update SetPersonalAccessToken and UpdatePersonalAccessToken to support multiple scopes and add force option for regeneration * Enhance Enter-TfsShell documentation and update release notes for Oh-My-Posh integration * Refactor ShouldContinue method to remove IsInteractive check for improved functionality * Update AGENTS.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Refactor CurrentConnectionsImpl.Set() to avoid redundant SyncEnvironmentVariables() calls Each Set(...) overload now directly assigns all fields instead of chaining to a shorter overload, so SyncEnvironmentVariables() is called exactly once per Set/Reset invocation instead of multiple times due to chaining. Agent-Logs-Url: https://github.com/igoravl/TfsCmdlets/sessions/aca670c1-4ebd-4f8d-9639-783b5e985e8f Co-authored-by: igoravl <725797+igoravl@users.noreply.github.com> * Bump actions/download-artifact from 4 to 8 (#259) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 8. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](actions/download-artifact@v4...v8) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: '8' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Igor Abade <igoravl@gmail.com> * Bump github/codeql-action from 3 to 4 (#258) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](github/codeql-action@v3...v4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Igor Abade <igoravl@gmail.com> * Bump actions/checkout from 4 to 6 (#256) Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Igor Abade <igoravl@gmail.com> * Bump actions/upload-artifact from 4 to 7 (#257) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 7. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](actions/upload-artifact@v4...v7) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '7' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Igor Abade <igoravl@gmail.com> * Bump System.Composition and System.Composition.Hosting (#260) Bumps System.Composition from 6.0.0 to 10.0.5 Bumps System.Composition.Hosting from 6.0.0 to 10.0.5 --- updated-dependencies: - dependency-name: System.Composition dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Composition.Hosting dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Igor Abade <igoravl@gmail.com> * Update release notes +semver:minor * Refactor Build.ps1 to enhance dependency management and update gitversion.yml to streamline workflow configuration * Add dotnet-tools.json for GitVersion tool configuration * Refactor main GitHub Actions workflow configuration * Enhance Install-DotNetTool function to check for tool manifest in multiple locations and restore tools from the manifest * Refactor Build.ps1 to use ordered dictionaries for dependency versions * Update action versions in workflows for consistency and security * Refactor build workflow to use PowerShell for asset packaging and release note extraction * Update gitversion.yml to change 'tag' to 'label' for pull-request configuration * Update pull-request mode in gitversion.yml to ContinuousDeployment * Enhance build versioning to include pre-release tags and commit count * Add input tag support to draft release finder in release workflow * Update release date for version 2.11.0 in changelog * Fix authentication errors when using Personal Access Token authentication with on-premises Servers * Add Install and Uninstall cmdlets for Azure DevOps Shell with Windows Terminal support * Update versioning in packaging tasks to use ThreePartVersion instead of NugetVersion * Enhance Azure DevOps Shell installation and uninstallation with Windows Terminal support and add color scheme fragments * Refactor Pester invocation in AllTests task to use New-PesterConfiguration for improved handling * Add Pester minimum version requirement and improve module installation logic * Remove obsolete License.rtf and TfsCmdletsShell.ico files; add new License.rtf to Setup directory * Update git add command to include all changes in release workflow --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: igoravl <725797+igoravl@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 6c8cbdd commit 351f272

40 files changed

Lines changed: 3882 additions & 451 deletions

.github/workflows/build.yml

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: Build
2+
3+
env:
4+
Config: Release
5+
Debug: ${{ false }}
6+
SkipReleaseNotes: ${{ true }}
7+
8+
on:
9+
pull_request:
10+
branches: [ main ]
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
18+
Build:
19+
20+
runs-on: windows-latest
21+
env:
22+
TFSCMDLETS_ACCESS_TOKEN: ${{ secrets.TFSCMDLETS_TOKEN }}
23+
TFSCMDLETS_COLLECTION_URL: 'https://dev.azure.com/tfscmdlets'
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v6
28+
with:
29+
fetch-depth: 0
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v4
32+
with:
33+
languages: csharp
34+
- name: Build module
35+
id: build_module
36+
shell: pwsh
37+
run: |
38+
./Build.ps1 -Targets Package -Config ${{ env.Config }} -Verbose:$${{ env.Debug }} -SkipReleaseNotes:$${{ env.SkipReleaseNotes }}
39+
- name: Perform CodeQL Analysis
40+
uses: github/codeql-action/analyze@v4
41+
- name: Publish Test Results
42+
uses: EnricoMi/publish-unit-test-result-action/windows@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0
43+
if: always()
44+
with:
45+
files: |
46+
out\TestResults-Pester*.xml
47+
- name: Publish Nuget
48+
uses: actions/upload-artifact@v7
49+
with:
50+
name: nuget
51+
path: "out/Nuget/*.nupkg"
52+
- name: Publish Chocolatey
53+
uses: actions/upload-artifact@v7
54+
with:
55+
name: chocolatey
56+
path: "out/Chocolatey/*.nupkg"
57+
- name: Publish Portable
58+
uses: actions/upload-artifact@v7
59+
with:
60+
name: portable
61+
path: "out/Portable/*.zip"
62+
- name: Publish MSI
63+
uses: actions/upload-artifact@v7
64+
with:
65+
name: msi
66+
path: "out/msi/*"
67+
- name: Publish WinGet
68+
uses: actions/upload-artifact@v7
69+
with:
70+
name: winget
71+
path: "out/winget/**"
72+
- name: Publish Docs
73+
uses: actions/upload-artifact@v7
74+
with:
75+
name: docs
76+
path: "out/docs/*.zip"
77+
- name: Publish Release Notes
78+
uses: actions/upload-artifact@v7
79+
with:
80+
name: releasenotes
81+
path: "RELEASENOTES.md"
82+
- name: Package additional release assets
83+
shell: pwsh
84+
run: |
85+
# Zip WinGet manifests
86+
Push-Location out/winget
87+
Compress-Archive -Path manifests -DestinationPath "TfsCmdlets-WinGet-$env:BUILD_NAME.zip" -Force
88+
Pop-Location
89+
# Rename Chocolatey package to avoid collision with NuGet package (same filename)
90+
Get-ChildItem 'out/Chocolatey/TfsCmdlets.*.nupkg' | ForEach-Object {
91+
Rename-Item $_ $_.Name.Replace('TfsCmdlets.', 'TfsCmdlets-Chocolatey.')
92+
}
93+
env:
94+
BUILD_NAME: ${{ steps.build_module.outputs.BUILD_NAME }}
95+
- name: Extract release notes
96+
id: extract_release_notes
97+
shell: pwsh
98+
run: |
99+
# Strip build metadata to get version
100+
$version = $env:BUILD_NAME -replace '\+.*$', ''
101+
102+
# Read release notes file
103+
$content = Get-Content RELEASENOTES.md -Raw
104+
105+
# Extract section between matching ## [version] header and next ## header
106+
$escaped = [regex]::Escape($version)
107+
$pattern = "(?m)^## \[$escaped\][^\n]*\n(.*?)(?=^## \[|\z)"
108+
$match = [regex]::Match($content, $pattern, [System.Text.RegularExpressions.RegexOptions]::Singleline)
109+
110+
if (-not $match.Success) {
111+
Write-Host "::error::No release notes found for version '$version' in RELEASENOTES.md"
112+
exit 1
113+
}
114+
115+
$notes = $match.Groups[1].Value.Trim()
116+
Write-Host $notes
117+
118+
# Write multi-line output
119+
"RELEASE_NOTES<<EOF" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
120+
$notes | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
121+
"EOF" | Out-File $env:GITHUB_OUTPUT -Append -Encoding utf8
122+
env:
123+
BUILD_NAME: ${{ steps.build_module.outputs.BUILD_NAME }}
124+
- name: Create Draft Release
125+
id: create_release
126+
shell: pwsh
127+
run: |
128+
# Remove stale draft releases
129+
$drafts = gh release list --json tagName,isDraft | ConvertFrom-Json | Where-Object { $_.isDraft }
130+
foreach ($draft in $drafts) {
131+
gh release delete $draft.tagName --yes --cleanup-tag
132+
}
133+
134+
# Create release notes file (avoids shell escaping issues)
135+
$env:RELEASE_NOTES | Set-Content release_notes.md -Encoding utf8
136+
137+
# Build args
138+
$ghArgs = @(
139+
'release', 'create', "v$env:BUILD_NAME",
140+
'--title', "Release $env:BUILD_NAME",
141+
'--notes-file', 'release_notes.md',
142+
'--draft',
143+
'--target', $env:COMMIT_SHA
144+
)
145+
146+
# Pre-release if version contains a hyphen (e.g. 1.0.0-rc.1)
147+
if ($env:BUILD_NAME -match '-') {
148+
$ghArgs += '--prerelease'
149+
}
150+
151+
# Attach assets
152+
$ghArgs += (Get-ChildItem out/msi/TfsCmdlets*.msi,
153+
out/Nuget/TfsCmdlets*.nupkg,
154+
out/Chocolatey/TfsCmdlets-Chocolatey*.nupkg,
155+
out/Portable/TfsCmdlets*.zip,
156+
out/docs/TfsCmdlets*.zip,
157+
out/winget/TfsCmdlets-WinGet-*.zip).FullName
158+
159+
gh @ghArgs
160+
env:
161+
BUILD_NAME: ${{ steps.build_module.outputs.BUILD_NAME }}
162+
RELEASE_NOTES: ${{ steps.extract_release_notes.outputs.RELEASE_NOTES }}
163+
COMMIT_SHA: ${{ github.sha }}

0 commit comments

Comments
 (0)