Skip to content

Commit 313ed92

Browse files
ci: use workflow runs API to detect built version
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent b249369 commit 313ed92

3 files changed

Lines changed: 47 additions & 8 deletions

File tree

.github/workflows/check-upstream-release.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
permissions:
1818
contents: read
1919
actions: write
20-
packages: read
2120
outputs:
2221
should_build: ${{ steps.check.outputs.should_build }}
2322
new_version: ${{ steps.check.outputs.new_version }}
@@ -42,16 +41,14 @@ jobs:
4241
# Fetch latest upstream version
4342
UPSTREAM_VERSION="${{ steps.upstream.outputs.version }}"
4443
45-
# Query GHCR for existing image tags - use repo-level packages API
46-
TAGS_RESPONSE=$(curl -s -H "Accept: application/vnd.github+json" \
44+
# Query workflow runs to find the last successful build with upstream version
45+
RUNS_RESPONSE=$(curl -s -H "Accept: application/vnd.github+json" \
4746
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
4847
-H "X-GitHub-Api-Version: 2022-11-28" \
49-
"https://api.github.com/repos/${{ github.repository }}/packages/container/opencode-server-docker/versions")
48+
"https://api.github.com/repos/${{ github.repository }}/actions/runs?status=success&per_page=5")
5049
51-
echo "GHCR response: $TAGS_RESPONSE"
52-
53-
# Find the latest upstream-* tag
54-
CURRENT_VERSION=$(echo "$TAGS_RESPONSE" | jq -r '.[] | .metadata.container.tags[]' 2>/dev/null | grep '^upstream-' | head -1 | sed 's/upstream-//')
50+
# Find the most recent run that was triggered by upstream-release and has upstream_version
51+
CURRENT_VERSION=$(echo "$RUNS_RESPONSE" | jq -r '.workflow_runs[] | select(.display_title? | contains("upstream")) | .inputs.upstream_version // empty' 2>/dev/null | head -1)
5552
5653
echo "Current built version: $CURRENT_VERSION"
5754
echo "Latest upstream version: $UPSTREAM_VERSION"

.sisyphus/boulder.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"active_plan": ".sisyphus/plans/fix-upstream-checker.md", "started_at": "2026-02-19T21:04:00Z", "session_ids": ["ses_placeholder"], "plan_name": "fix-upstream-checker"}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Fix: Upstream Release Checker GHCR API Issue
2+
3+
## Context
4+
The `check-upstream-release.yml` workflow fails to detect previously built versions because:
5+
1. GHCR packages are owned by users/orgs, not repos directly
6+
2. The API endpoint `repos/{owner}/{repo}/packages/container/...` returns 404
7+
3. Need to use a more reliable method to track built versions
8+
9+
## Plan
10+
11+
### Task 1: Fix version detection to use workflow runs API
12+
13+
**What to do**:
14+
- Replace GHCR API call with GitHub Actions workflow runs API
15+
- Query last successful runs to find upstream version that was built
16+
- Update the check-release job logic
17+
18+
**Files**:
19+
- `.github/workflows/check-upstream-release.yml`
20+
21+
**QA Scenarios**:
22+
23+
Scenario: Happy path - new version detected
24+
Tool: Bash (simulation)
25+
Preconditions: Last workflow run had upstream_version="v1.2.5", new release is "v1.2.6"
26+
Steps:
27+
1. Simulate API response with old run showing v1.2.5
28+
2. New upstream shows v1.2.6
29+
3. Verify should_build=true
30+
Expected Result: should_build=true, new_version=v1.2.6, old_version=v1.2.5
31+
Evidence: Console output showing version comparison
32+
33+
Scenario: No change - same version
34+
Tool: Bash (simulation)
35+
Preconditions: Last workflow run had upstream_version="v1.2.6", new release is "v1.2.6"
36+
Steps:
37+
1. Simulate API response with run showing v1.2.6
38+
2. New upstream shows v1.2.6
39+
3. Verify should_build=false
40+
Expected Result: should_build=false
41+
Evidence: Console output "No new version. Already at: v1.2.6"

0 commit comments

Comments
 (0)