Skip to content

Conversation

@Chizaruu
Copy link
Owner

Migrated the release notes generation step from bash to PowerShell for improved compatibility and maintainability. Enhanced commit listing to use GitHub API for author usernames, added fallback to git log, and improved release note formatting for both pre-release and standard releases.

Migrated the release notes generation step from bash to PowerShell for improved compatibility and maintainability. Enhanced commit listing to use GitHub API for author usernames, added fallback to git log, and improved release note formatting for both pre-release and standard releases.
Copilot AI review requested due to automatic review settings October 18, 2025 06:08
Changed the workflow branch filter from '*testing*' to '*naming*' to trigger releases on branches related to naming instead of testing.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors the release notes generation in the GitHub Actions workflow from bash to PowerShell, adds GitHub API-based commit author resolution with a git log fallback, and improves formatting for pre-release and standard releases.

  • Switch release-notes generation step to PowerShell
  • Use GitHub API to enrich commit list with GitHub usernames; fallback to git log
  • Adjust formatting for pre-release and standard releases; add testing branch trigger
Comments suppressed due to low confidence (1)

.github/workflows/release.yml:1

  • In the fallback path, $commits is an array of lines from git, but later it's interpolated into a string, which PowerShell joins with spaces, breaking Markdown list formatting. Convert the array to a newline-delimited string and then test for emptiness, e.g.: $commits = (git log ... ) -join "`n"; and similarly join in both branches before the emptiness check.
name: Visual Studio Extension Release

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines 289 to 314
# Get commits with GitHub usernames using GitHub API
try {
Write-Host "Fetching commits from GitHub API..."
$apiResponse = gh api "repos/${{ github.repository }}/commits?sha=${{ github.sha }}&per_page=100" --jq '.[] | "\(.commit.message | split("\n")[0])||\(.author.login // "unknown")||\(.sha[0:7])"'
**Version:** v${{ steps.version.outputs.DISPLAY_VERSION }}
**Commit:** ${{ github.sha }}
**Changes ($TAG_INFO):**
$COMMITS
## Installation
1. Download the \`.vsix\` file below
2. Double-click to install in Visual Studio
3. Or use: \`Extensions > Manage Extensions > Install from file\`"
else
RELEASE_BODY="## ${{ steps.version-bump.outputs.BUMP_TYPE == 'patch' && '🐛 Patch' || steps.version-bump.outputs.BUMP_TYPE == 'minor' && '✨ Minor' || '🚨 Major' }} Version Bump
$commitList = @()
foreach ($line in $apiResponse) {
$parts = $line -split '\|\|'
$message = $parts[0]
$author = $parts[1]
$sha = $parts[2]
# Stop if we've reached the last tag
if (![string]::IsNullOrEmpty($lastCommitSha) -and $sha -eq $lastCommitSha.Substring(0, 7)) {
break
}
$commitList += "- $message by @$author ($sha)"
}
$commits = $commitList -join "`n"
Write-Host "✅ Successfully fetched commits with GitHub usernames"
}
catch {
Write-Host "⚠️ Failed to get commits from GitHub API: $_"
Write-Host "Falling back to git log..."
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The try/catch will not catch failures from the native gh command because non-zero exit codes from external processes are non-terminating in PowerShell. As a result, the fallback to git log may never run. After invoking gh, check $LASTEXITCODE (or $?) and explicitly throw on failure to trigger the catch, e.g.: $apiResponse = gh api ...; if ($LASTEXITCODE -ne 0 -or -not $apiResponse) { throw 'gh api failed' }.

Copilot uses AI. Check for mistakes.
# Get commits with GitHub usernames using GitHub API
try {
Write-Host "Fetching commits from GitHub API..."
$apiResponse = gh api "repos/${{ github.repository }}/commits?sha=${{ github.sha }}&per_page=100" --jq '.[] | "\(.commit.message | split("\n")[0])||\(.author.login // "unknown")||\(.sha[0:7])"'
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GitHub API call is limited to per_page=100 and does not paginate, so releases with more than 100 commits since the last tag will be truncated. Use gh api --paginate to fetch all pages, e.g.: gh api --paginate "repos/.../commits?sha=...&per_page=100" and process the combined output.

Suggested change
$apiResponse = gh api "repos/${{ github.repository }}/commits?sha=${{ github.sha }}&per_page=100" --jq '.[] | "\(.commit.message | split("\n")[0])||\(.author.login // "unknown")||\(.sha[0:7])"'
$apiResponse = gh api --paginate "repos/${{ github.repository }}/commits?sha=${{ github.sha }}&per_page=100" --jq '.[] | "\(.commit.message | split("\n")[0])||\(.author.login // "unknown")||\(.sha[0:7])"'

Copilot uses AI. Check for mistakes.
Comment on lines 339 to 342
$releaseBody += "## Installation`n"
$releaseBody += "1. Download the `.vsix` file below`n"
$releaseBody += "2. Double-click to install in Visual Studio`n"
$releaseBody += "3. Or use: ``Extensions > Manage Extensions > Install from file```n"
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Installation block is duplicated across pre-release and standard branches. Consider building this once (e.g., $installation = "..."), then appending it in both branches to reduce duplication and the risk of inconsistent future edits.

Copilot uses AI. Check for mistakes.
Adds error handling for the GitHub API call and refactors installation instructions to reduce duplication in the release notes generation script within the release workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants