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