Skip to content

Reassess which property is being used to calculate oldest commit age #42

@lanaebk

Description

@lanaebk

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"
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions