Skip to content

Commit 2aaf297

Browse files
committed
adding deleted tutorial packages
1 parent 5f26876 commit 2aaf297

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

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

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -237,40 +237,42 @@ jobs:
237237
exit 1
238238
fi
239239
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-
247240
# Filter for tutorial-agents from this repo
248241
TUTORIAL_PACKAGES=$(echo "$PACKAGES" | \
249242
jq -r '.[] | select(.repository != null and .repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents"))) | .name')
250243
251244
echo "Tutorial packages in registry:"
252245
echo "$TUTORIAL_PACKAGES"
253246
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"
247+
echo ""
248+
echo "🔍 Checking for deprecated packages..."
249+
while IFS= read -r package_name; do
250+
[ -z "$package_name" ] && continue
251+
252+
# Extract agent name: scale-agentex-python/tutorial-agents/00_sync-000_hello_acp -> 00_sync-000_hello_acp
253+
agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||')
254+
255+
if echo "$REPO_AGENTS" | grep -q "^${agent_name}$"; then
256+
echo "✅ $agent_name - still in repo"
257+
else
258+
echo "🗑️ $agent_name - NOT in repo, deleting..."
259+
# URL encode the package name (replace / with %2F)
260+
encoded_package=$(echo "$package_name" | sed 's|/|%2F|g')
261+
response=$(curl -s -w "\n%{http_code}" -X DELETE \
262+
-H "Authorization: Bearer $GITHUB_TOKEN" \
263+
-H "Accept: application/vnd.github+json" \
264+
"https://api.github.com/orgs/scaleapi/packages/container/${encoded_package}")
265+
266+
http_code=$(echo "$response" | tail -n1)
267+
body=$(echo "$response" | sed '$d')
268+
269+
if [ "$http_code" = "204" ] || [ "$http_code" = "200" ]; then
270+
echo " ✅ Deleted: $package_name"
271+
else
272+
echo " ⚠️ Failed to delete $package_name (HTTP $http_code): $body"
273+
fi
274+
fi
275+
done <<< "$TUTORIAL_PACKAGES"
274276
275277
echo ""
276278
echo "✅ Deprecation check complete"

0 commit comments

Comments
 (0)