From ca2832a34ad7068af28a7437b141ee3b91512154 Mon Sep 17 00:00:00 2001 From: Fabien Boucher Date: Tue, 31 Oct 2023 08:49:45 +0000 Subject: [PATCH] Use `committedDate` for ChangeCommitForcePushedEvent's `created_at` field Also this change uses `committedDate` for `ChangeCommitPushedEvent`'s `created_at` instead of `pushedDate` which is deprecated. fix #1074 --- CHANGELOG.md | 2 ++ src/Lentille/GitHub/GraphQLFragments.hs | 4 +++- src/Lentille/GitHub/PullRequests.hs | 4 ++-- src/Lentille/GitHub/UserPullRequests.hs | 4 ++-- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 902476ff7..b85fd754d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file. ### Changed - `workspaceName` is typed as `IndexName`, which respect ElasticSearch constraints +- [crawler] `ChangeCommitPushedEvent` and `ChangeCommitForcePushedEvent` events date (`created_at`) is the commit date of the + related commit. ### Removed diff --git a/src/Lentille/GitHub/GraphQLFragments.hs b/src/Lentille/GitHub/GraphQLFragments.hs index e53822bd1..0f1245a2f 100644 --- a/src/Lentille/GitHub/GraphQLFragments.hs +++ b/src/Lentille/GitHub/GraphQLFragments.hs @@ -109,11 +109,13 @@ fragmentPRData = } ... on HeadRefForcePushedEvent { id - createdAt fpactor: actor { __typename login } + afterCommit { + forcePushCommittedDate: committedDate + } } } } diff --git a/src/Lentille/GitHub/PullRequests.hs b/src/Lentille/GitHub/PullRequests.hs index 706425592..a6e1e8d81 100644 --- a/src/Lentille/GitHub/PullRequests.hs +++ b/src/Lentille/GitHub/PullRequests.hs @@ -191,9 +191,9 @@ transformResponse host identCB result = do ( GetProjectPullRequestsRepositoryPullRequestsNodesTimelineItemsNodesHeadRefForcePushedEvent _ eId - createdAt (Just (GetProjectPullRequestsRepositoryPullRequestsNodesTimelineItemsNodesFpactor _ actor)) - ) -> toMaybeForcePushedEvent change eId getIdent actor createdAt + (Just (GetProjectPullRequestsRepositoryPullRequestsNodesTimelineItemsNodesAfterCommit createdAt')) + ) -> toMaybeForcePushedEvent change eId getIdent actor createdAt' _ -> Nothing getCommitEvents :: Change -> GetProjectPullRequestsRepositoryPullRequestsNodesCommits -> [ChangeEvent] diff --git a/src/Lentille/GitHub/UserPullRequests.hs b/src/Lentille/GitHub/UserPullRequests.hs index 14cd25ad2..f4aef734a 100644 --- a/src/Lentille/GitHub/UserPullRequests.hs +++ b/src/Lentille/GitHub/UserPullRequests.hs @@ -188,9 +188,9 @@ transformResponse host identCB result = do ( GetUserPullRequestsUserPullRequestsNodesTimelineItemsNodesHeadRefForcePushedEvent _ eId - createdAt (Just (GetUserPullRequestsUserPullRequestsNodesTimelineItemsNodesFpactor _ actor)) - ) -> toMaybeForcePushedEvent change eId getIdent actor createdAt + (Just (GetUserPullRequestsUserPullRequestsNodesTimelineItemsNodesAfterCommit createdAt')) + ) -> toMaybeForcePushedEvent change eId getIdent actor createdAt' _ -> Nothing getCommitEvents :: Change -> GetUserPullRequestsUserPullRequestsNodesCommits -> [ChangeEvent]