|
56 | 56 | needs: [check-permissions] |
57 | 57 | outputs: |
58 | 58 | agents: ${{ steps.get-agents.outputs.agents }} |
| 59 | + all_agents: ${{ steps.get-agents.outputs.all_agents }} |
59 | 60 | has_agents: ${{ steps.get-agents.outputs.has_agents }} |
60 | 61 | steps: |
61 | 62 | - name: Checkout repository |
|
72 | 73 | all_agents=$(find examples/tutorials -name "manifest.yaml" -exec dirname {} \; | sort) |
73 | 74 | agents_to_build=() |
74 | 75 |
|
| 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 | +
|
75 | 80 | if [ "$REBUILD_ALL" = "true" ]; then |
76 | 81 | echo "Rebuild all agents requested" |
77 | 82 | agents_to_build=($(echo "$all_agents")) |
@@ -199,3 +204,59 @@ jobs: |
199 | 204 | agentex agents build $BUILD_ARGS |
200 | 205 | echo "✅ Build validation successful for: ${{ matrix.agent_path }}" |
201 | 206 | 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 | + # Filter for tutorial-agents from this repo |
| 234 | + TUTORIAL_PACKAGES=$(echo "$PACKAGES" | \ |
| 235 | + jq -r '.[] | select(.repository.name == "scale-agentex-python" and (.name | contains("tutorial-agents"))) | .name') |
| 236 | +
|
| 237 | + echo "Tutorial packages in registry:" |
| 238 | + echo "$TUTORIAL_PACKAGES" |
| 239 | +
|
| 240 | + # |
| 241 | + # echo "" |
| 242 | + # echo "🔍 Checking for deprecated packages..." |
| 243 | + # while IFS= read -r package_name; do |
| 244 | + # [ -z "$package_name" ] && continue |
| 245 | + # |
| 246 | + # # Extract agent name: scale-agentex-python/tutorial-agents/00_sync-000_hello_acp -> 00_sync-000_hello_acp |
| 247 | + # agent_name=$(echo "$package_name" | sed 's|.*/tutorial-agents/||') |
| 248 | + # |
| 249 | + # if echo "$REPO_AGENTS" | grep -q "^${agent_name}$"; then |
| 250 | + # echo "✅ $agent_name - still in repo" |
| 251 | + # else |
| 252 | + # echo "🗑️ $agent_name - NOT in repo, deleting..." |
| 253 | + # curl -s -X DELETE \ |
| 254 | + # -H "Authorization: Bearer $GITHUB_TOKEN" \ |
| 255 | + # -H "Accept: application/vnd.github+json" \ |
| 256 | + # "https://api.github.com/orgs/scaleapi/packages/container/$(echo "$package_name" | sed 's|/|%2F|g')" |
| 257 | + # echo " Deleted: $package_name" |
| 258 | + # fi |
| 259 | + # done <<< "$TUTORIAL_PACKAGES" |
| 260 | +
|
| 261 | + echo "" |
| 262 | + echo "✅ Deprecation check complete" |
0 commit comments