Skip to content

Commit 42489cc

Browse files
lostindarkCopilot
andcommitted
fix: improve release highlights integration and error handling
Release workflow: - Use timestamp and event-based API filtering to identify the dispatched highlights run, avoiding race conditions - Replace verbose gh run watch with quiet polling loop - Skip artifact download when highlights workflow fails - Surface download errors as warnings instead of suppressing Release highlights prompt: - Compare against last published release, not previous tag - Prioritize commits over PRs for change detection - Try multiple jq paths when extracting agent output - Stop agent immediately after saving highlights Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent fa5f876 commit 42489cc

3 files changed

Lines changed: 70 additions & 42 deletions

File tree

.github/workflows/release-highlights.lock.yml

Lines changed: 27 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/release-highlights.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,17 @@ safe-outputs:
2626
steps:
2727
- name: Save highlights
2828
run: |
29-
HIGHLIGHTS=$(jq -r '.items[0].highlights // empty' "$GH_AW_AGENT_OUTPUT")
29+
# Try multiple possible paths in agent output
30+
HIGHLIGHTS=$(jq -r '
31+
.items[0].highlights //
32+
.items[0].body //
33+
.items[0].content //
34+
(.items[] | select(.type == "save_highlights") | .highlights) //
35+
empty
36+
' "$GH_AW_AGENT_OUTPUT" 2>/dev/null || true)
3037
if [ -z "$HIGHLIGHTS" ]; then
31-
echo "No highlights found in agent output"
38+
echo "::warning::No highlights found in agent output, dumping structure:"
39+
jq '.' "$GH_AW_AGENT_OUTPUT" 2>/dev/null || cat "$GH_AW_AGENT_OUTPUT"
3240
exit 1
3341
fi
3442
echo "$HIGHLIGHTS" >> "$GITHUB_STEP_SUMMARY"

.github/workflows/release.yml

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,41 +68,53 @@ jobs:
6868
env:
6969
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7070
run: |
71-
gh workflow run release-highlights.lock.yml -f version="v${{ inputs.version }}"
71+
$version = "v${{ inputs.version }}"
72+
$dispatchTime = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
73+
gh workflow run release-highlights.lock.yml -f version="$version"
7274
Start-Sleep -Seconds 10
7375
74-
# Find the triggered run (most recent in_progress or queued)
75-
$run = $null
76-
for ($i = 0; $i -lt 24; $i++) {
77-
$runs = gh run list --workflow=release-highlights.lock.yml --limit=5 --json databaseId,status,createdAt | ConvertFrom-Json
78-
$run = $runs | Where-Object { $_.status -in @("in_progress", "queued", "waiting", "pending") } | Select-Object -First 1
79-
if ($run) { break }
80-
# Also check if it already completed (fast run)
81-
$run = $runs | Where-Object { $_.createdAt -gt (Get-Date).AddMinutes(-2).ToString("yyyy-MM-ddTHH:mm:ssZ") } | Select-Object -First 1
82-
if ($run) { break }
76+
# Find the triggered run created after dispatch time
77+
$runId = $null
78+
for ($i = 0; $i -lt 60; $i++) {
79+
$runs = gh api "repos/${{ github.repository }}/actions/workflows/release-highlights.lock.yml/runs?event=workflow_dispatch&created=%3E%3D$dispatchTime&per_page=5" | ConvertFrom-Json
80+
if ($runs.workflow_runs.Count -gt 0) {
81+
$runId = $runs.workflow_runs[0].id
82+
Write-Host "Found matching run: $runId (status: $($runs.workflow_runs[0].status))"
83+
break
84+
}
8385
Start-Sleep -Seconds 5
8486
}
85-
if (-not $run) { throw "Could not find release highlights run" }
87+
if (-not $runId) {
88+
Write-Host "::warning::Could not find release highlights run after 5 minutes, skipping"
89+
exit 0
90+
}
8691
87-
Write-Host "Waiting for release highlights run $($run.databaseId)..."
88-
do {
92+
Write-Host "Waiting for release highlights run $runId..."
93+
for ($i = 0; $i -lt 20; $i++) {
8994
Start-Sleep -Seconds 30
90-
$status = (gh run view $run.databaseId --json status,conclusion | ConvertFrom-Json)
95+
$status = (gh run view $runId --json status,conclusion | ConvertFrom-Json)
9196
Write-Host " Status: $($status.status)"
92-
} while ($status.status -ne "completed")
97+
if ($status.status -eq "completed") { break }
98+
}
99+
100+
if ($status.status -ne "completed") {
101+
Write-Host "::warning::Release highlights timed out after 10 minutes, skipping"
102+
exit 0
103+
}
93104
94105
if ($status.conclusion -ne "success") {
95-
Write-Host "Release highlights finished with conclusion: $($status.conclusion)"
96-
} else {
97-
Write-Host "Release highlights completed successfully"
106+
Write-Host "::warning::Release highlights finished with conclusion: $($status.conclusion)"
107+
exit 0
98108
}
99109
100110
# Download the artifact
101-
gh run download $run.databaseId -n release-highlights -D highlights-output
102-
if (Test-Path highlights-output/release-highlights.md) {
111+
$downloadOutput = gh run download $runId -n release-highlights -D highlights-output 2>&1
112+
if ($LASTEXITCODE -ne 0) {
113+
Write-Host "::warning::Failed to download highlights artifact: $downloadOutput"
114+
} elseif (Test-Path highlights-output/release-highlights.md) {
103115
Write-Host "Release highlights downloaded"
104116
} else {
105-
Write-Host "No highlights artifact found, will use --generate-notes"
117+
Write-Host "::warning::Highlights artifact downloaded but file not found"
106118
}
107119
108120
- name: Create GitHub release

0 commit comments

Comments
 (0)