Skip to content

Commit 99b36f3

Browse files
authored
chore: adjust effort comment (#29)
1 parent 199a0ca commit 99b36f3

File tree

1 file changed

+2
-33
lines changed

1 file changed

+2
-33
lines changed

action.js

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -181,31 +181,10 @@ module.exports = async (
181181
bail(error.message);
182182
};
183183

184-
// estimate effort if a PR
184+
// comment on effort if a PR
185185
if (includeEffort) {
186-
// get weekdays since PR's first commit
187-
let prCreatedAt = new Date();
188-
effortMessage = `Please set effort on project item card:\n\n`;
189-
prCommitData.forEach(commit => {
190-
const commitDate = new Date(commit.commit.authoredDate);
191-
if (commitDate < prCreatedAt) {
192-
prCreatedAt = commitDate;
193-
}
194-
});
195-
const workingDaysSinceCreated = countWorkingDaysSince(new Date(prCreatedAt));
196-
197-
// map days spent to effort size pattern
198-
let milestonePattern;
199186
let effortMappingObj = JSON.parse(effortMapping);
200-
for (const element of effortMappingObj) {
201-
if (workingDaysSinceCreated < element.value) {
202-
milestonePattern = element.pattern;
203-
break;
204-
}
205-
};
206-
if (!milestonePattern) {
207-
bail("cannot estimate effort");
208-
};
187+
effortMessage = `Please set effort on project item card:\n\n`;
209188
// list human-readable efforts
210189
projectFieldOptions.forEach(field => {
211190
if (field.name === effortName) {
@@ -222,16 +201,6 @@ module.exports = async (
222201
});
223202
};
224203
});
225-
// suggest an effort value
226-
projectFieldOptions.forEach(field => {
227-
if (field.name === effortName) {
228-
field.options.forEach(effort => {
229-
if (effort.name.toLowerCase().includes(milestonePattern.toLowerCase())) {
230-
effortMessage += `\nBased on first commit date, ${effort.name} should be adequate.`;
231-
};
232-
});
233-
};
234-
});
235204
};
236205
};
237206

0 commit comments

Comments
 (0)