From 1f6706f7b40914e6cd77dde94bc3d1bbbc7a521e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 26 Sep 2024 16:34:29 +0200 Subject: [PATCH] properly print instructions when the api reports don't match MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .changeset/five-turkeys-taste.md | 5 +++++ .../repo-tools/src/commands/api-reports/api-extractor.ts | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .changeset/five-turkeys-taste.md diff --git a/.changeset/five-turkeys-taste.md b/.changeset/five-turkeys-taste.md new file mode 100644 index 0000000000..7f3361ebbf --- /dev/null +++ b/.changeset/five-turkeys-taste.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Properly log instructions when APIs do not match diff --git a/packages/repo-tools/src/commands/api-reports/api-extractor.ts b/packages/repo-tools/src/commands/api-reports/api-extractor.ts index 70b4e54739..90c5c40fdd 100644 --- a/packages/repo-tools/src/commands/api-reports/api-extractor.ts +++ b/packages/repo-tools/src/commands/api-reports/api-extractor.ts @@ -519,14 +519,17 @@ export async function runApiExtraction({ if (message.text.includes('The API report file is missing')) { shouldLogInstructions = true; } + + // Detect messages like the following being output by the generator: + // Warning: You have changed the API signature for this project. Please copy the file "/home/runner/work/backstage/backstage/node_modules/.cache/api-extractor/backend-test-utils/report.api.md" to "report.api.md", or perform a local build (which does this automatically). See the Git repo documentation for more info. if ( message.text.includes( - 'You have changed the public API signature for this project.', + 'You have changed the API signature for this project.', ) ) { shouldLogInstructions = true; const match = message.text.match( - /Please copy the file "(.*)" to "api-report\.api\.md"/, + /Please copy the file "(.*)" to "report\.api\.md"/, ); if (match) { conflictingFile = match[1];