Skip to content

Commit

Permalink
feat: add support for mentioning the issue author
Browse files Browse the repository at this point in the history
  • Loading branch information
dessant committed Jun 16, 2018
1 parent b9bb7e8 commit b43e76e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ The file can be empty, or it can override any of these default settings:
# Label used to mark issues as support requests
supportLabel: support

# Comment to post on issues marked as support requests. Add a link
# to a support page, or set to `false` to disable
# Comment to post on issues marked as support requests, `{issue-author}` is an
# optional placeholder. Set to `false` to disable
supportComment: >
👋 We use the issue tracker exclusively for bug reports and feature requests.
However, this issue appears to be a support request. Please use our
support channels to get help with the project.
:wave: @{issue-author}, we use the issue tracker exclusively for bug reports
and feature requests. However, this issue appears to be a support request.
Please use our support channels to get help with the project.
# Close issues marked as support requests
close: true
Expand Down
10 changes: 5 additions & 5 deletions assets/app-description.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Create `.github/support.yml` in the default branch to enable the app. The file c
# Label used to mark issues as support requests
supportLabel: support

# Comment to post on issues marked as support requests. Add a link
# to a support page, or set to `false` to disable
# Comment to post on issues marked as support requests, `{issue-author}` is an
# optional placeholder. Set to `false` to disable
supportComment: >
We use the issue tracker exclusively for bug reports and feature requests.
However, this issue appears to be a support request. Please use our
support channels to get help with the project.
:wave: @{issue-author}, we use the issue tracker exclusively for bug reports
and feature requests. However, this issue appears to be a support request.
Please use our support channels to get help with the project.
# Close issues marked as support requests
close: true
Expand Down
12 changes: 7 additions & 5 deletions src/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ const schema = Joi.object().keys({
.try(Joi.string(), Joi.boolean().only(false))
.error(() => '"supportComment" must be a string or false')
.default(
'👋 We use the issue tracker exclusively for bug reports ' +
'and feature requests. However, this issue appears to be a support ' +
'request. Please use our support channels to get help with the project.'
':wave: @{issue-author}, we use the issue tracker exclusively ' +
'for bug reports and feature requests. However, this issue appears ' +
'to be a support request. Please use our support channels ' +
'to get help with the project.'
)
.description(
'Comment to post on issues marked as support requests. ' +
'Add a link to a support page, or set to `false` to disable'
'Comment to post on issues marked as support requests, ' +
'`{issue-author}` is an optional placeholder. ' +
'Set to `false` to disable'
),

close: Joi.boolean()
Expand Down
6 changes: 5 additions & 1 deletion src/support.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ module.exports = class Support {
const {perform, supportComment, close, lock} = this.config;

if (supportComment && !this.issueLocked()) {
const commentBody = supportComment.replace(
/{issue-author}/,
this.context.payload.issue.user.login
);
if (perform) {
this.logger.info(`${owner}/${repo}#${number} is being commented on`);
await this.context.github.issues.createComment({
owner,
repo,
number,
body: supportComment
body: commentBody
});
} else {
this.logger.info(
Expand Down

0 comments on commit b43e76e

Please sign in to comment.