From 111dec496037c9b25c9e1efd9641e5b473a8d9a6 Mon Sep 17 00:00:00 2001 From: Patrick Lewis <4015312+locus313@users.noreply.github.com> Date: Fri, 26 Jun 2026 14:16:36 -0700 Subject: [PATCH] fix: handle __404__ sentinel in github-dockerfile-discovery - search_org_dockerfiles: add __404__ to the existing __422__ guard so orgs with no code-search access are skipped cleanly instead of trying to jq-parse the sentinel string - fetch_dockerfile_content: check for __404__ and __422__ alongside the empty-string guard to avoid a misleading 'Unexpected encoding' warning when a file is not found Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../github-dockerfile-discovery.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enterprise/github-dockerfile-discovery/github-dockerfile-discovery.sh b/enterprise/github-dockerfile-discovery/github-dockerfile-discovery.sh index 06201b5..29d0523 100644 --- a/enterprise/github-dockerfile-discovery/github-dockerfile-discovery.sh +++ b/enterprise/github-dockerfile-discovery/github-dockerfile-discovery.sh @@ -136,7 +136,7 @@ search_dockerfiles_in_org() { local resp resp=$(gh_api "/search/code?q=filename:Dockerfile+org:${org}&per_page=100&page=${page}") - if [ "${resp}" = "__422__" ]; then + if [[ "${resp}" == "__422__" || "${resp}" == "__404__" ]]; then print_warning " Code search not available for org '${org}'. Skipping." return 0 fi @@ -282,7 +282,7 @@ fetch_and_parse_dockerfile() { resp=$(gh_api "/repos/${repo_full_name}/contents/${encoded_path}" 2>/dev/null || echo "") - if [ -z "${resp}" ]; then + if [[ -z "${resp}" || "${resp}" == "__404__" || "${resp}" == "__422__" ]]; then print_warning " Could not fetch ${repo_full_name}/${path}" return 0 fi