2828 outputs :
2929 agent-matrix : ${{ steps.discover.outputs.agent-matrix }}
3030 steps :
31+ - name : Setup GitHub CLI
32+ run : |
33+ echo "📦 GitHub CLI version:"
34+ gh --version || {
35+ echo "Installing GitHub CLI..."
36+ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
37+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
38+ sudo apt update
39+ sudo apt install gh
40+ }
41+
3142 - name : Login to GitHub Container Registry
3243 uses : docker/login-action@v3
3344 with :
@@ -40,24 +51,48 @@ jobs:
4051 env :
4152 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4253 run : |
43- echo "🔍 Discovering tutorial agent images from GHCR using gh CLI..."
54+ echo "🔍 Discovering tutorial agent images using packages API..."
55+
56+ # Debug: Check token permissions
57+ echo "🔍 Debugging token permissions..."
58+ echo "Token starts with: ${GITHUB_TOKEN:0:10}..."
59+ echo "Repository owner: ${{ github.repository_owner }}"
4460
45- # Debug: Test basic API access first
46- echo "Testing basic API access ..."
47- gh api user --jq '.login ' || echo "Basic API failed"
61+ # Test basic API access
62+ echo "Testing rate limit API ..."
63+ gh api rate_limit --jq '.rate.limit ' || echo "Rate limit API failed"
4864
49- # Try repository-level packages first (more likely to work)
50- echo "Fetching packages from scale-agentex-python repository..."
65+ # Test org access
66+ echo "Testing org access..."
67+ gh api orgs/scaleapi --jq '.login' || echo "Cannot access org"
68+
69+ echo "🔍 Attempting to access packages..."
70+
71+ # Workflow tokens can't access org-level packages, try repository-level
72+ echo "Testing repository-level packages..."
5173 gh api repos/scaleapi/scale-agentex-python/packages \
5274 --field package_type=container \
53- --jq '.[] | select(.name | contains("tutorial-agents")) | .name' > packages.txt 2>/dev/null || {
54- echo "Repository packages failed, trying organization packages..."
55-
56- # Fallback to org packages with simpler query
57- gh api orgs/scaleapi/packages \
58- --field package_type=container \
59- --jq '.[] | select(.name | startswith("scale-agentex-python/tutorial-agents/")) | .name' > packages.txt 2>/dev/null || {
60- echo "Organization packages also failed, using fallback list..."
75+ --field per_page=100 > packages_raw.json || {
76+ echo "Repository packages failed, checking if packages exist..."
77+
78+ # Alternative: Try to infer from repository structure
79+ echo "Falling back to repository directory structure..."
80+ gh api repos/scaleapi/scale-agentex-python/contents/tutorial-agents \
81+ --jq '.[] | select(.type == "dir") | "scaleapi/scale-agentex-python/tutorial-agents/" + .name' > packages.txt || {
82+ echo "Directory structure also failed - no packages found"
83+ touch packages.txt
84+ }
85+ exit 0
86+ }
87+
88+ echo "Raw repository packages response:"
89+ head -20 packages_raw.json
90+
91+ # Filter for tutorial agents packages
92+ jq -r '.[] | select(.name | contains("tutorial-agents")) | "scaleapi/" + .name' packages_raw.json > packages.txt || {
93+ echo "No tutorial-agents packages found in response"
94+ touch packages.txt
95+ }
6196
6297 echo "📋 Found tutorial agent packages:"
6398 cat packages.txt
70105 if [[ -n "$package_name" ]]; then
71106 echo "Processing package: $package_name"
72107
73- # Extract agent name from package (e.g., "00_sync-000_hello_acp")
108+ # Extract agent directory name (e.g., "00_sync-000_hello_acp")
74109 agent_dir=$(basename "$package_name")
75110
76111 # Convert to agent name format (e.g., "s000-hello-acp")
85120 AGENT_IMAGES+=","
86121 fi
87122
88- AGENT_IMAGES+='{"name":"'$agent_dir'","image":"ghcr.io/scaleapi/ '$package_name':latest","agent_name":"'$agent_name'"}'
123+ AGENT_IMAGES+='{"name":"'$agent_dir'","image":"ghcr.io/'$package_name':latest","agent_name":"'$agent_name'"}'
89124 fi
90125 done < packages.txt
91126
98133 echo "agent-matrix=$(echo "$AGENT_IMAGES" | jq -c '.')" >> $GITHUB_OUTPUT
99134
100135 # Cleanup
101- rm -f packages.txt
136+ rm -f packages.txt packages_raw.json
102137
103138 run-integration-tests :
104139 name : " Run Integration Tests - ${{ matrix.agent.name }}"
0 commit comments