diff --git a/.github/workflows/context7-registration-check.yml b/.github/workflows/context7-registration-check.yml index 7ac22d9a2..3b1baf6da 100644 --- a/.github/workflows/context7-registration-check.yml +++ b/.github/workflows/context7-registration-check.yml @@ -62,6 +62,16 @@ jobs: registered = result.get('libraryName') if isinstance(registered, str) and registered.lower() == library: report.append('Registered library: ' + library) + exists = status == 400 and result.get('error') == 'library-already-exists' + if exists: + refresh_status, refreshed = request('/v1/refresh', { + 'libraryName': library, 'branch': 'master'}) + report.append('Refresh HTTP status: ' + str(refresh_status)) + for field in ('error', 'message'): + detail = refreshed.get(field) + if isinstance(detail, str): + report.append('Refresh ' + field + ': ' + + json.dumps(detail.replace(key, '[REDACTED]')[:500])) query = urllib.parse.urlencode({ 'libraryId': library, @@ -69,6 +79,11 @@ jobs: 'type': 'json'}) retrieval_status, context = request('/v2/context?' + query) report.append('Retrieval HTTP status: ' + str(retrieval_status)) + for field in ('error', 'message'): + detail = context.get(field) + if isinstance(detail, str): + report.append('Retrieval ' + field + ': ' + + json.dumps(detail.replace(key, '[REDACTED]')[:500])) sources = [] for field, url_field in [('codeSnippets', 'codeId'), ('infoSnippets', 'pageId')]: snippets = context.get(field, []) @@ -88,7 +103,7 @@ jobs: print(summary) with open(os.environ['GITHUB_STEP_SUMMARY'], 'a') as output: output.write(summary) - if status not in (200, 202, 409): + if status not in (200, 202, 409) and not exists: raise SystemExit('Repository registration did not succeed; see HTTP status above.') if retrieval_status != 200 or not sources: raise SystemExit('Main-repository retrieval is not yet verified.')