Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lanaebk opened this issue Jan 11, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@lanaebk
Copy link
Contributor

lanaebk commented Jan 11, 2021

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"
        }
    }
}
@lanaebk lanaebk added the bug Something isn't working label Jan 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant