mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-09 19:22:51 +00:00
feat: notify merge request assignee instead of author
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
} from '@openstapps/gitlab-api/lib/types';
|
||||
import {WebClient} from '@slack/client';
|
||||
import {logger} from '../common';
|
||||
import {GROUPS, NOTE_PREFIX} from '../configuration';
|
||||
import {GROUPS, NOTE_PREFIX, SLACK_CHANNEL} from '../configuration';
|
||||
|
||||
export async function remind(api: Api): Promise<void> {
|
||||
// get list of open merge requests
|
||||
@@ -58,18 +58,18 @@ export async function remind(api: Api): Promise<void> {
|
||||
});
|
||||
|
||||
if (hasUnresolvedDiscussions) {
|
||||
// send message to slack
|
||||
await client.chat.postMessage({
|
||||
channel: 'C762UG76Z',
|
||||
text: `Merge request '${mergeRequest.title}' has unresolved discussions! See ${mergeRequest.web_url}!`,
|
||||
});
|
||||
let recipient = mergeRequest.author.username;
|
||||
|
||||
if (typeof mergeRequest.assignee !== 'undefined') {
|
||||
recipient = mergeRequest.assignee.username;
|
||||
}
|
||||
|
||||
// create note in merge request
|
||||
await api.createNote(
|
||||
mergeRequest.project_id,
|
||||
Scope.MERGE_REQUESTS,
|
||||
mergeRequest.iid,
|
||||
`${NOTE_PREFIX} Please resolve pending discussions, @${mergeRequest.author.username}!`,
|
||||
`${NOTE_PREFIX} Please resolve pending discussions, @${recipient}!`,
|
||||
);
|
||||
|
||||
return;
|
||||
@@ -95,7 +95,7 @@ export async function remind(api: Api): Promise<void> {
|
||||
|
||||
// send message to slack
|
||||
await client.chat.postMessage({
|
||||
channel: 'C762UG76Z',
|
||||
channel: SLACK_CHANNEL,
|
||||
text: `Merge request '${mergeRequest.title}' needs more approvals! See ${mergeRequest.web_url}!`,
|
||||
});
|
||||
|
||||
@@ -111,7 +111,7 @@ export async function remind(api: Api): Promise<void> {
|
||||
|
||||
// send message to slack
|
||||
await client.chat.postMessage({
|
||||
channel: 'C762UG76Z',
|
||||
channel: SLACK_CHANNEL,
|
||||
text: `Merge request '${mergeRequest.title}' is ready to be merged! See ${mergeRequest.web_url}!`,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user