Skip to content

Commit

Permalink
added slack user mention
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomás Altrui committed Aug 9, 2019
1 parent ff6725a commit 6794998
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@
],
"channel": "team-web",
"labelsToAvoid": ["Ready for Release!", "Release", "HOLD"],
"directives": ["PRReminder"]
"directives": ["PRReminder"],
"teamMembers": {
"Sebastian Gulino": "ULTNW0DPX",
"Tomás Altrui": "ULFLTG7J6"
}
}
3 changes: 2 additions & 1 deletion src/directives/PRReminder/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import moment from 'moment';
import { getSlackId } from '../../utils/slack';

const prTextFormater = pr => {
const today = moment();
Expand All @@ -24,7 +25,7 @@ const prTextFormater = pr => {
text: `• *${pr.repo}* | <${pr.link}|*${
pr.title
}*>\n _Asignados_: ${pr.assignees
.map(assignee => `*${assignee.name}*`)
.map(assignee => `*${getSlackId(assignee.name)}*`)
.join(', ')}\n _Abierto hace_: ${openSince}`
}
};
Expand Down
6 changes: 6 additions & 0 deletions src/utils/slack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import config from './config';

export const getSlackId = name =>
typeof config.teamMembers[name] === 'string'
? `<@${config.teamMembers[name]}>`
: name;

0 comments on commit 6794998

Please sign in to comment.