Merge pull request #26863 from backstage/freben/match

properly print instructions when the api reports don't match
This commit is contained in:
Fredrik Adelöw
2024-09-27 14:12:49 +02:00
committed by GitHub
2 changed files with 10 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/repo-tools': patch
---
Properly log instructions when APIs do not match
@@ -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];