Skip to content

Commit 6ab08f1

Browse files
locus313Copilot
andauthored
fix: handle __404__ sentinel in github-dockerfile-discovery (#25)
- 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>
1 parent 6df5f43 commit 6ab08f1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

enterprise/github-dockerfile-discovery/github-dockerfile-discovery.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ search_dockerfiles_in_org() {
136136
local resp
137137
resp=$(gh_api "/search/code?q=filename:Dockerfile+org:${org}&per_page=100&page=${page}")
138138

139-
if [ "${resp}" = "__422__" ]; then
139+
if [[ "${resp}" == "__422__" || "${resp}" == "__404__" ]]; then
140140
print_warning " Code search not available for org '${org}'. Skipping."
141141
return 0
142142
fi
@@ -282,7 +282,7 @@ fetch_and_parse_dockerfile() {
282282

283283
resp=$(gh_api "/repos/${repo_full_name}/contents/${encoded_path}" 2>/dev/null || echo "")
284284

285-
if [ -z "${resp}" ]; then
285+
if [[ -z "${resp}" || "${resp}" == "__404__" || "${resp}" == "__422__" ]]; then
286286
print_warning " Could not fetch ${repo_full_name}/${path}"
287287
return 0
288288
fi

0 commit comments

Comments
 (0)