Skip to content

Github issue closed support and improvements#898

Merged
epipav merged 8 commits intomainfrom
improvement/gh-integration-issues-closed
May 25, 2023
Merged

Github issue closed support and improvements#898
epipav merged 8 commits intomainfrom
improvement/gh-integration-issues-closed

Conversation

@epipav
Copy link
Copy Markdown
Collaborator

@epipav epipav commented May 24, 2023

Changes proposed ✍️

  • Support for issues-closed activities in both graphQL and webhooks.
  • Updates bad sourceIds for PR events (We were using the pr opener member as activity owner when generating the sourceId for the PR events - assigned, pr reviewed, pr review requested), now the sourceId is generated using the activity owner instead.
  • PR Review activities now have the additional attribute field reviewState as commented | approved | change requested
  • Now we get the reviewers (both team and members) and assignees from payload.requested_reviewer, payload.assignee and payload.requested_team before we were getting these from pull_request object using payload.pull_request.requested_reviewer and payload.pull_request.assignee which was causing problems because apparently GitHub returns the all (including historical assigns) assignees in pull_request.assignees
  • Updates the attributes.state of PR merged activities to merged - since we were duplicating these from closed activities the state was closed before for pull_request-merged activities.

What

🤖 Generated by Copilot at ff1b5de

This pull request improves the GitHub integration service by using the correct source identifier for pull request and issue activities, and by fetching and parsing the closed events of the issues. It modifies the githubIntegrationService.ts and the issues.ts files to implement these changes.

🤖 Generated by Copilot at ff1b5de

IssuesQuery grows
Fetching timeline items now
Winter of closed bugs

Why

How

🤖 Generated by Copilot at ff1b5de

  • Modify the sourceId of the activities generated from pull request events to use the sender.login instead of the user.login of the pull request author, to reflect the user who performed the action (link, link, link)
  • Declare and assign four variables (sourceId, sourceParentId, body, and title) at the beginning of the parseWebhook method in githubIntegrationService.ts, to be used later for generating activities based on the issue events, to avoid repeating the same logic and to make the code more readable and consistent (link, link, link, link)
  • Modify the parseWebhookMember method call in githubIntegrationService.ts, to use the sender.login instead of the issue.user.login, to get the member information of the user who triggered the issue event, to match the logic of using the sender.login for the sourceId of the activity (link)
  • Add a call to the parseIssueEvents method in githubIntegrationService.ts, which is a new method that parses the timeline items of the issue and generates activities for each supported event type, such as CLOSED_EVENT, and concatenates the output array with the existing output array (link)
  • Add the implementation of the parseIssueEvents method in githubIntegrationService.ts, which iterates over the records of the timeline items, and uses a switch statement to handle different event types, and pushes a new activity object to the output array, with the appropriate properties and attributes based on the event type, and logs a warning message for any unsupported event type (link)
  • Add a new field to the IssuesQuery class in issues.ts, which is a GraphQL query that fetches the issues from the GitHub API, to get the information of the closed events of the issues, such as the actor and the created date, which are needed for generating the activities in the parseIssueEvents method, and uses a fragment to select the relevant fields of the actor (link)

Checklist ✅

  • Label appropriately with Feature, Improvement, or Bug.
  • Add screehshots to the PR description for relevant FE changes
  • New backend functionality has been unit-tested.
  • API documentation has been updated (if necessary) (see docs on API documentation).
  • Quality standards are met.

@epipav epipav requested a review from joanreyero May 24, 2023 13:33
@epipav epipav marked this pull request as ready for review May 24, 2023 13:33
@epipav epipav requested a review from themarolt May 25, 2023 12:23
@epipav epipav added the Improvement Created by Linear-GitHub Sync label May 25, 2023
@epipav epipav merged commit b112891 into main May 25, 2023
@epipav epipav deleted the improvement/gh-integration-issues-closed branch May 25, 2023 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement Created by Linear-GitHub Sync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants