Skip to content

Commit

Permalink
feat: config autoAssignToCreator
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Jul 17, 2018
1 parent a94e8d4 commit 78c278a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.js
Expand Up @@ -273,6 +273,22 @@ const obtainRepoContext = context => {
* @param {import('probot').Application} app - Probot's Application class.
*/
module.exports = app => {
app.on('pull_request.opened', async context => {
const repoContext = await obtainRepoContext(context);
if (!repoContext) return;

if (repoContext.config.autoAssignToCreator) {
const pr = context.payload.pull_request;
if (pr.assignees.length !== 0) return;

await context.github.issues.addAssigneesToIssue(
context.issue({
assignees: [pr.user.login],
})
);
}
});

app.on('pull_request.review_requested', async context => {
const repoContext = await obtainRepoContext(context);
if (!repoContext) return;
Expand Down
1 change: 1 addition & 0 deletions teamconfig.js
Expand Up @@ -2,6 +2,7 @@

module.exports = {
slackToken: process.env.ORNIKAR_SLACK_TOKEN,
autoAssignToCreator: true,
dev: {
abarreir: `alexandre${process.env.ORNIKAR_EMAIL_DOMAIN}`,
christophehurpeau: `christophe${process.env.ORNIKAR_EMAIL_DOMAIN}`,
Expand Down

0 comments on commit 78c278a

Please sign in to comment.