-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When computing the oldestCommit
value for BranchAge
Bot Action, we currently calculate by comparing the created_at
timestamp to the timestamp of the time we receive the Merge Request Hook event from GitLab.
However, I have observed cases where the created_at
and committed_date
values (along with the actual id
of the commit) change while the authored_date
stays the same for the same commit. Further investigation is required to understand under which circumstances this change takes place.
I propose that we update BranchAge
to calculate oldestCommit
value based on authored_date
.
See below for a real example (with user data masked) pulled from the logs today:
The commit when the MR event first got sent to GRDBot
{
"name": "BranchAge",
"statusCode": 200,
"action": {
"goodGitPractice": false,
"mrNote": ":loudspeaker: This merge request has a pretty old commit. You should try and merge more frequently to keep your commits on branches fresh. [#BranchAgeAnalysis](https:\/\/github.com\/Cigna\/GitRDoneBot#2-branch-age)"
},
"computedValues": {
"oldestCommit": {
"id": "a1234",
"short_id": "a12",
"created_at": "2020-12-11T20:07:07.000Z",
"parent_ids": [],
"title": "does some stuff",
"message": "does some stuff",
"author_name": "River Tam",
"author_email": "RiverTam@fake.com",
"authored_date": "2020-12-08T20:18:48.000Z",
"committer_name": "River Tam",
"committer_email": "RiverTam@fake.com",
"committed_date": "2020-12-11T20:07:07.000Z"
}
}
The same commit when the MR sent an update event 10 minutes later
{
"name": "BranchAge",
"statusCode": 200,
"action": {
"goodGitPractice": true,
"mrNote": ":star: It\u2019s great that you\u2019re committing and merging code frequently - the commits on this branch aren\u2019t old or stale. Good job! [#BranchAgeAnalysis](https:\/\/github.com\/Cigna\/GitRDoneBot#2-branch-age)"
},
"computedValues": {
"oldestCommit": {
"id": "b1234",
"short_id": "b12",
"created_at": "2021-01-11T19:01:50.000Z",
"parent_ids": [],
"title": "does some stuff",
"message": "does some stuff",
"author_name": "River Tam",
"author_email": "RiverTam@fake.com",
"authored_date": "2020-12-08T20:18:48.000Z",
"committer_name": "River Tam",
"committer_email": "RiverTam@fake.com",
"committed_date": "2021-01-11T19:01:50.000Z"
}
}
}