mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-10-30 04:15:45 +08:00
ci(docs): refresh existing Context7 library on master
Co-authored-by: multica-agent <[email protected]>
This commit is contained in:
co-authored by
multica-agent
parent
46e5241e09
commit
3bd39a961f
@@ -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.')
|
||||
|
||||
Reference in New Issue
Block a user