Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

fix: use pathFile in the pr labels comment, not an undeclared trigger (#705)

Tássio Noronha032d487e34e9
diff --git a/.github/workflows/pr-labels.yml b/.github/workflows/pr-labels.yml
index 48a9d051..f24bf561 100644
--- a/.github/workflows/pr-labels.yml
+++ b/.github/workflows/pr-labels.yml
@@ -137,9 +137,17 @@ jobs:
const requires = level === 'high'
? 'It needs two approvals, an agreed design on the issue, and a rollback plan.'
: 'It needs a review from the area owner and tests on the changed path.';
+ // Name the source that decided. When the diff came out riskier
+ // than triage expected, that gap is worth reading rather than
+ // silently overwriting.
+ const why = fromIssue
+ ? `inherited from #${issueRef}`
+ : (pathFile ? `this PR touches \`${pathFile}\`` : 'the changed paths');
+ const gap = (!fromIssue && issueLevel
+ && ORDER.indexOf(pathLevel) > ORDER.indexOf(issueLevel))
+ ? ` This came out riskier than #${issueRef} estimated (risk: ${issueLevel}).` : '';
const note = skipped
? ` (${skipped} lines in generated files were not counted for size.)` : '';
await github.rest.issues.createComment({ ...repo, issue_number: pr.number,
body: `Labelled \`risk: ${level}\` and \`size: ${size}\` automatically: ` +
- `this PR touches \`${trigger}\` and changes ${lines} reviewable lines. ` +
- `${requires}${note}` });
+ `${why}, ${lines} reviewable lines. ${requires}${gap}${note}` });