Skip to content

Commit 0903231

Browse files
lostindarkCopilot
andcommitted
fix: use GH_AW_AGENT_OUTPUT for custom safe output and improve run detection
The custom safe output job was using invalid agent.output context. Use GH_AW_AGENT_OUTPUT env var instead. Also improve run detection in release workflow to find the correct triggered run by status and creation time rather than just picking the most recent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a42548e commit 0903231

3 files changed

Lines changed: 36 additions & 27 deletions

File tree

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

Lines changed: 22 additions & 18 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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ safe-outputs:
2626
steps:
2727
- name: Save highlights
2828
run: |
29-
HIGHLIGHTS=$(echo '${{ toJSON(agent.output.highlights) }}' | jq -r '.')
29+
HIGHLIGHTS=$(jq -r '.items[0].highlights // empty' "$GH_AW_AGENT_OUTPUT")
30+
if [ -z "$HIGHLIGHTS" ]; then
31+
echo "No highlights found in agent output"
32+
exit 1
33+
fi
3034
echo "$HIGHLIGHTS" >> "$GITHUB_STEP_SUMMARY"
3135
echo "$HIGHLIGHTS" > release-highlights.md
3236
- name: Upload artifact

.github/workflows/release.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,17 @@ jobs:
6969
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7070
run: |
7171
gh workflow run release-highlights.lock.yml -f version="v${{ inputs.version }}"
72-
Start-Sleep -Seconds 5
72+
Start-Sleep -Seconds 10
7373
74-
# Find the triggered run
74+
# Find the triggered run (most recent in_progress or queued)
7575
$run = $null
76-
for ($i = 0; $i -lt 12; $i++) {
77-
$runs = gh run list --workflow=release-highlights.lock.yml --limit=1 --json databaseId,status,conclusion | ConvertFrom-Json
78-
if ($runs.Count -gt 0) {
79-
$run = $runs[0]
80-
break
81-
}
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 }
8283
Start-Sleep -Seconds 5
8384
}
8485
if (-not $run) { throw "Could not find release highlights run" }

0 commit comments

Comments
 (0)