Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
node_modules
*.pem
.DS_Store
package-lock.json
13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,17 @@ module.exports = robot => {
}
}
if ((!body || badTitle || badBody) && notExcludedUser) {
const comment = getComment(config.requestInfoReplyComment, defaultConfig.requestInfoReplyComment)
context.github.issues.createComment(context.issue({body: comment}))
robot.on(['issues.labeled', 'pull_request.labeled'], async function issuePullLabeled (context) {
const label = await context.github.issues.getIssueLabels(context.issue())
const labelData = label.data
const requestLabel = labelData.find(label => {
return label.name === 'request-info'
})
if (requestLabel) {
const comment = getComment(config.requestInfoReplyComment, defaultConfig.requestInfoReplyComment)
context.github.issues.createComment(context.issue({body: comment}))
}
})

if (config.requestInfoLabelToAdd) {
// Add label if there is one listed in the yaml file
Expand Down
26 changes: 0 additions & 26 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toHaveBeenCalled()
expect(github.issues.addLabels).toHaveBeenCalled()
})
})

Expand All @@ -56,9 +53,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toHaveBeenCalled()
expect(github.issues.addLabels).toHaveBeenCalled()
})
})

Expand All @@ -71,9 +65,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toNotHaveBeenCalled()
expect(github.issues.addLabels).toNotHaveBeenCalled()
})
})
})
Expand All @@ -96,9 +87,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toNotHaveBeenCalled()
expect(github.issues.addLabels).toNotHaveBeenCalled()
})
})

Expand All @@ -111,9 +99,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toNotHaveBeenCalled()
expect(github.issues.addLabels).toNotHaveBeenCalled()
})
})

Expand All @@ -126,9 +111,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toHaveBeenCalled()
expect(github.issues.addLabels).toHaveBeenCalled()
})
})
})
Expand Down Expand Up @@ -181,9 +163,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toHaveBeenCalled()
expect(github.issues.addLabels).toHaveBeenCalled()
})
})
})
Expand All @@ -206,9 +185,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toHaveBeenCalled()
expect(github.issues.addLabels).toNotHaveBeenCalled()
})
})
})
Expand Down Expand Up @@ -266,8 +242,6 @@ describe('Request info', () => {
repo: 'testing-things',
path: '.github/config.yml'
})

expect(github.issues.createComment).toHaveBeenCalled()
})

it('Does not post a comment when PR body is different from template', async () => {
Expand Down