Skip to content

Commit

Permalink
Don't tag the maintainers on known user errors (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
rzadp authored Aug 8, 2023
1 parent cd06e9f commit 48fb9f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/bot-handle-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ export const handleIssueCommentCreated = async (state: State, event: IssueCommen
} else {
await githubComment(result.errorMessage);
await githubEmojiReaction("confused");
await matrixNotifyOnFailure(state.matrix, event);
await matrixNotifyOnFailure(state.matrix, event, { tagMaintainers: false });
}
} catch (e) {
state.bot.log.error(e.message);
await githubComment(
`@${tipRequester} Could not submit tip :( The team has been notified. Alternatively open an issue [here](https://github.com/paritytech/substrate-tip-bot/issues/new).`,
);
await githubEmojiReaction("confused");
await matrixNotifyOnFailure(state.matrix, event);
await matrixNotifyOnFailure(state.matrix, event, { tagMaintainers: true });
}
};

Expand Down
6 changes: 4 additions & 2 deletions src/matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ export const matrixNotifyOnNewTip = async (matrix: State["matrix"], event: Issue
export const matrixNotifyOnFailure = async (
matrix: State["matrix"],
event: IssueCommentCreatedEvent,
opts: { tagMaintainers: boolean },
): Promise<void> => {
const tag = opts.tagMaintainers ? `${teamMatrixHandles.join(" ")} ` : "";
await sendMatrixMessage(matrix, {
text: `${teamMatrixHandles.join(" ")} A tip has failed: ${event.comment.html_url}`,
html: `${teamMatrixHandles.join(" ")} A tip has <a href="${event.comment.html_url}">failed</a>!`,
text: `${tag}A tip has failed: ${event.comment.html_url}`,
html: `${tag}A tip has <a href="${event.comment.html_url}">failed</a>!`,
});
};

0 comments on commit 48fb9f4

Please sign in to comment.