Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
Ignore edits to issues predating the bot (#13460)
Browse files Browse the repository at this point in the history
  • Loading branch information
strugee authored and Hainish committed Nov 2, 2017
1 parent 99b126b commit d3ced54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions utils/issue-format-bot/lib/issueedit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const parse = require('./parse'),
labeler = require('./labeler'),
_ = require('lodash');

// We do this outside the event handler to avoid setting up and tearing down this object each time a hook is received
const botStartDate = new Date('2018-09-25');

// TODO make this share more with newissue.js?

module.exports = function(robot, alexa) {
Expand All @@ -20,6 +23,12 @@ module.exports = function(robot, alexa) {
return;
}

const createdAt = new Date(context.payload.issue.created_at);
if (createdAt <= botStartDate) {
robot.log('Ignoring event for a legacy, pre-bot issue.');
return;
}

const data = parse(context.payload.issue.body);

// Check if the data is problematic
Expand Down
2 changes: 1 addition & 1 deletion utils/issue-format-bot/test/labeler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function resetSpies(context) {
}

function addLabelsCalledOnce(err, context) {
assert.ok(context.github.issues.addLabels.calledOnce);
assert.isTrue(context.github.issues.addLabels.calledOnce);
}

function assertWhichLabel(label) {
Expand Down

0 comments on commit d3ced54

Please sign in to comment.