From aadba5b4483c8dd021758282cc7d8efc5b005d48 Mon Sep 17 00:00:00 2001 From: Son Chau Date: Thu, 23 Nov 2023 12:05:23 -0800 Subject: [PATCH] Update update-schema.yaml --- .github/workflows/update-schema.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-schema.yaml b/.github/workflows/update-schema.yaml index 71e0c5d60..9608d7b05 100644 --- a/.github/workflows/update-schema.yaml +++ b/.github/workflows/update-schema.yaml @@ -93,8 +93,11 @@ jobs: let schemaLines = schemaJson.split('\n'); for (let i = 0; i < 10; ++i) { console.log('Original schemaLines:', schemaLines[i]); - if ("description: This is the RESTful API for the MoH Service." === schemaLines[i].trim()) { - schemaLines[i] += ' Based on https://raw.githubusercontent.com/' + context.repo.owner + '/' + context.repo.repo + '/' + repoSha + '/' + repoPath + 'schema.json'; + let descStr = '{"description": "This is the RESTful API for the MoH Service."}'; + let textLink = ' Based on https://raw.githubusercontent.com/' + context.repo.owner + '/' + context.repo.repo + '/' + repoSha + '/' + repoPath + 'schema.json'; + if (descStr === schemaLines[i].trim()) { + //schemaLines[i] += ' Based on https://raw.githubusercontent.com/' + context.repo.owner + '/' + context.repo.repo + '/' + repoSha + '/' + repoPath + 'schema.json'; + schemaLines[i] = schemaLines[i].replace(/("description": "This is the RESTful API for the MoH Service.")/, `$1 ${textLink}`); } } schemaJson = schemaLines.join('\n');