@@ -18007,6 +18007,11 @@ async function run() {
18007
18007
console.log('Comment body is either empty or doesn\'t contain the keyword "Proposal": ', payload.comment?.body);
18008
18008
return;
18009
18009
}
18010
+ // If event is `edited` and comment was already edited by the bot, return early
18011
+ if (isCommentEditedEvent(payload) && payload.comment?.body.trim().includes('Edited by **proposal-police**')) {
18012
+ console.log('Comment was already edited by proposal-police once.\n', payload.comment?.body);
18013
+ return;
18014
+ }
18010
18015
console.log('ProposalPolice™ Action triggered for comment:', payload.comment?.body);
18011
18016
console.log('-> GitHub Action Type: ', payload.action?.toUpperCase());
18012
18017
if (!isCommentCreatedEvent(payload) && !isCommentEditedEvent(payload)) {
@@ -18033,12 +18038,7 @@ async function run() {
18033
18038
if (isCommentCreatedEvent(payload) && isActionRequired) {
18034
18039
const formattedResponse = message
18035
18040
// replace {user} from response template with @username
18036
- .replaceAll('{user}', `@${payload.comment?.user.login}`)
18037
- // replace {proposalLink} from response template with the link to the comment
18038
- .replaceAll('{proposalLink}', payload.comment?.html_url)
18039
- // remove any double quotes from the final comment because sometimes the assistant's
18040
- // response contains double quotes / sometimes it doesn't
18041
- .replaceAll('"', '');
18041
+ .replaceAll('{user}', `@${payload.comment?.user.login}`);
18042
18042
// Create a comment with the assistant's response
18043
18043
console.log('ProposalPolice™ commenting on issue...');
18044
18044
await GithubUtils_1.default.createComment(CONST_1.default.APP_REPO, github_1.context.issue.number, formattedResponse);
0 commit comments