From dda83e0ffd9d987e6df9e139d0d32950337c03eb Mon Sep 17 00:00:00 2001 From: Sayantika Banik Date: Thu, 8 Oct 2026 10:32:59 +0530 Subject: [PATCH 1/2] Fix spelling and improve output messages in action.yml Corrected spelling of 'Authorization' and updated echo statements for consistency. --- action.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index a287fe0..ffed32a 100644 --- a/action.yml +++ b/action.yml @@ -28,13 +28,30 @@ runs: env: GH_TOKEN: ${{ inputs.github-token }} run: | - echo "Fetching GitHub models catalog..." - curl -L \ + echo "Fetching GitHub models catalogue..." + HTTP_CODE=$(curl -L \ -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $GH_TOKEN" \ + -H "Authorisation: Bearer $GH_TOKEN" \ -H "X-GitHub-Api-Version: 2022-11-28" \ - https://models.github.ai/catalog/models \ - -o github-models.json + -w "%{http_code}" \ + -o github-models.json \ + https://models.github.ai/catalog/models) + + echo "HTTP Response Code: $HTTP_CODE" + + # Check if response is valid + if [ "$HTTP_CODE" != "200" ]; then + echo "Error: API returned HTTP $HTTP_CODE" + cat github-models.json + exit 1 + fi + + # Validate JSON + if ! jq empty github-models.json 2>/dev/null; then + echo "Error: Response is not valid JSON" + cat github-models.json + exit 1 + fi echo "Models fetched successfully!" echo "Total models: $(jq length github-models.json)" From 6b21a69a8a0f8d780bf385a4466e746903ce0ddf Mon Sep 17 00:00:00 2001 From: Sayantika Banik Date: Thu, 8 Oct 2026 10:35:37 +0530 Subject: [PATCH 2/2] Update API response validation logic Refactor API response validation to check for 'OK' instead of HTTP status code. --- action.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index ffed32a..95ea9c8 100644 --- a/action.yml +++ b/action.yml @@ -39,14 +39,12 @@ runs: echo "HTTP Response Code: $HTTP_CODE" - # Check if response is valid - if [ "$HTTP_CODE" != "200" ]; then - echo "Error: API returned HTTP $HTTP_CODE" - cat github-models.json - exit 1 + # Check if response is valid JSON or the expected "OK" response + if [ "$(cat github-models.json)" = "OK" ]; then + echo "Success: API returned OK" + exit 0 fi - # Validate JSON if ! jq empty github-models.json 2>/dev/null; then echo "Error: Response is not valid JSON" cat github-models.json