Skip to content

Commit 5f26876

Browse files
author
Roxanne Farhad
committed
remove deprecated packages
1 parent f93ace8 commit 5f26876

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/build-and-push-tutorial-agent.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
needs: [check-permissions]
5757
outputs:
5858
agents: ${{ steps.get-agents.outputs.agents }}
59+
all_agents: ${{ steps.get-agents.outputs.all_agents }}
5960
has_agents: ${{ steps.get-agents.outputs.has_agents }}
6061
steps:
6162
- name: Checkout repository
@@ -72,6 +73,10 @@ jobs:
7273
all_agents=$(find examples/tutorials -name "manifest.yaml" -exec dirname {} \; | sort)
7374
agents_to_build=()
7475
76+
# Output all agents for deprecation check
77+
all_agents_json=$(printf '%s\n' $all_agents | jq -R -s -c 'split("\n") | map(select(length > 0))')
78+
echo "all_agents=$all_agents_json" >> $GITHUB_OUTPUT
79+
7580
if [ "$REBUILD_ALL" = "true" ]; then
7681
echo "Rebuild all agents requested"
7782
agents_to_build=($(echo "$all_agents"))
@@ -199,3 +204,73 @@ jobs:
199204
agentex agents build $BUILD_ARGS
200205
echo "✅ Build validation successful for: ${{ matrix.agent_path }}"
201206
fi
207+
208+
deprecate-agents:
209+
name: "Deprecate Removed Agents"
210+
runs-on: ubuntu-latest
211+
needs: [find-agents]
212+
steps:
213+
- name: Find and delete deprecated agent packages
214+
env:
215+
GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
216+
run: |
217+
set -e
218+
219+
echo "🔍 Agents in repo (from find-agents):"
220+
# Convert JSON array of paths to package names
221+
# e.g., "examples/tutorials/00_sync/000_hello_acp" -> "00_sync-000_hello_acp"
222+
REPO_AGENTS=$(echo '${{ needs.find-agents.outputs.all_agents }}' | jq -r '.[]' | \
223+
sed 's|examples/tutorials/||' | \
224+
sed 's|/|-|g')
225+
echo "$REPO_AGENTS"
226+
227+
echo ""
228+
echo "🔍 Fetching packages from GitHub Container Registry..."
229+
PACKAGES=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
230+
-H "Accept: application/vnd.github+json" \
231+
"https://api.github.com/orgs/scaleapi/packages?package_type=container&per_page=100")
232+
233+
# Check for API errors
234+
if echo "$PACKAGES" | jq -e '.message' > /dev/null 2>&1; then
235+
echo "❌ GitHub API error:"
236+
echo "$PACKAGES" | jq '.'
237+
exit 1
238+
fi
239+
240+
# Verify response is an array
241+
if ! echo "$PACKAGES" | jq -e 'type == "array"' > /dev/null 2>&1; then
242+
echo "❌ Unexpected API response format:"
243+
echo "$PACKAGES" | head -c 500
244+
exit 1
245+
fi
246+
247+
# Filter for tutorial-agents from this repo
248+
TUTORIAL_PACKAGES=$(echo "$PACKAGES" | \
249+
jq -r '.[] | select(.repository != null and .repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents"))) | .name')
250+
251+
echo "Tutorial packages in registry:"
252+
echo "$TUTORIAL_PACKAGES"
253+
254+
#
255+
# echo ""
256+
# echo "🔍 Checking for deprecated packages..."
257+
# while IFS= read -r package_name; do
258+
# [ -z "$package_name" ] && continue
259+
#
260+
# # Extract agent name: scale-agentex-python/tutorial-agents/00_sync-000_hello_acp -> 00_sync-000_hello_acp
261+
# agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||')
262+
#
263+
# if echo "$REPO_AGENTS" | grep -q "^${agent_name}$"; then
264+
# echo "✅ $agent_name - still in repo"
265+
# else
266+
# echo "🗑️ $agent_name - NOT in repo, deleting..."
267+
# curl -s -X DELETE \
268+
# -H "Authorization: Bearer $GITHUB_TOKEN" \
269+
# -H "Accept: application/vnd.github+json" \
270+
# "https://api.github.com/orgs/scaleapi/packages/container/$(echo "$package_name" | sed 's|/|%2F|g')"
271+
# echo " Deleted: $package_name"
272+
# fi
273+
# done <<< "$TUTORIAL_PACKAGES"
274+
275+
echo ""
276+
echo "✅ Deprecation check complete"

0 commit comments

Comments
 (0)