Skip to content

Commit 8e7af78

Browse files
authored
feat(action): log failed strings with reasons on validation failure (#32)
When validation fails, the action now logs each failed string with its file location, content, and reason for failure. This makes it easier to identify and fix issues directly from the GitHub Actions log.
1 parent 83acab4 commit 8e7af78

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/action.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,29 @@ async function run(): Promise<void> {
8181
}
8282
}
8383

84-
if (result.summary.pass) {
85-
core.info(`✅ Validation passed: ${result.summary.reason}`);
86-
} else {
87-
core.setFailed(`❌ Validation failed: ${result.summary.reason}`);
88-
}
89-
9084
if (result.results.length > 0) {
9185
core.info(`📊 Processed ${result.results.length} strings`);
9286
const validCount = result.results.filter(r => r.valid).length;
9387
core.info(`✅ ${validCount} valid, ❌ ${result.results.length - validCount} invalid`);
9488
}
9589

90+
if (result.summary.pass) {
91+
core.info(`✅ Validation passed: ${result.summary.reason}`);
92+
} else {
93+
const failedResults = result.results.filter(r => !r.valid);
94+
if (failedResults.length > 0) {
95+
core.info('');
96+
core.info('Failed strings:');
97+
for (const failed of failedResults) {
98+
core.info(` ${failed.file}:${failed.line}`);
99+
core.info(` String: "${failed.content}"`);
100+
core.info(` Reason: ${failed.message}`);
101+
}
102+
core.info('');
103+
}
104+
core.setFailed(`❌ Validation failed: ${result.summary.reason}`);
105+
}
106+
96107
} catch (error) {
97108
core.setFailed(`Action failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
98109
}

0 commit comments

Comments
 (0)